Video, audio and graphics decode, composite and display system

ABSTRACT

A video, audio and graphics system uses multiple transport processors to receive in-band and out-of-band MPEG Transport streams, to perform PID and section filtering as well as DVB and DES decryption and to de-multiplex them. The system processes the PES into digital audio, MPEG video and message data. The system is capable of decoding multiple MPEG SLICEs concurrently. Graphics windows are blended in parallel, and blended with video using alpha blending. During graphics processing, a single-port SRAM is used equivalently as a dual-port SRAM. The video may include both analog video, e.g., NTSC/PAL/SECAM/S-video, and digital video, e.g., MPEG-2 video in SDTV or HDTV format. The system has a reduced memory mode in which video images are reduced in half in horizontal direction only during decoding. The system is capable of receiving and processing digital audio signals such as MPEG Layer 1 and Layer 2 audio and Dolby AC-3 audio, as well as PCM audio signals. The system includes a memory controller. The system includes a system bridge controller to interface a CPU with devices internal to the system as well as peripheral devices including PCI devices and I/O devices such as RAM, ROM and flash memory devices. The system is capable of displaying video and graphics in both the high definition (HD) mode and the standard definition (SD) mode. The system may output an HDTV video while converting the HDTV video and providing as another output having an SDTV format or another HDTV format.

CROSS-REFERENCE TO RELATED APPLICATION(S)

This application is a continuation of “VIDEO, AUDIO AND GRAPHICS DECODE,COMPOSITE AND DISPLAY SYSTEM”, application Ser. No. 10/997,652, filedNov. 23, 2004, issued as U.S. Pat. No. 7,110,006 on Sep. 19, 2006, andwhich is a continuation-in-part of U.S. patent application Ser. No.09/437,208, filed Nov. 9, 1999 now U.S. Pat. No. 6,570,579 and entitled“Graphics Display System,” and claims the benefit of the filing date ofU.S. provisional patent application No. 60/170,866, filed Dec. 14, 1999and entitled “Graphics Chip Architecture,” the contents of which arehereby incorporated by reference.

The present application contains subject matter related to the subjectmatter disclosed in U.S. patent application Ser. No. 09/641,936, nowissued as U.S. Pat. No. 6,636,222 on Oct. 21, 2003, entitled “Video andGraphics System with an MPEG Video Decoder for Concurrent Multi-RowDecoding,” U.S. patent application Ser. No. 09/643,223, now issued asU.S. Pat. No. 6,661,422 on Dec. 9, 2003, entitled “Video and GraphicsSystem with MPEG Specific Data Transfer Commands,” U.S. patentapplication Ser. No. 09/640,870 now issued as U.S. Pat. No. 6,768,774 onJul. 27, 2004 entitled “Video and Graphics System with Video Scaling,”U.S. patent application Ser. No. 09/641,930 entitled “Video and GraphicsSystem with a Data Transport Processor,” U.S. patent application Ser.No. 09/640,869, now issued as U.S. Pat. No. 6,538,656 on Mar. 25, 2003,entitled “Video and Graphics System with a Video Transport Processor,”U.S. patent application Ser. No. 09/641,935, now issued as U.S. Pat. No.6,573,905 on Jun. 3, 2003, entitled “Video and Graphics System withParallel Processing of Graphics Windows,” U.S. patent application Ser.No. 09/642,510 now issued as U.S. Pat. No. 6,798,420 on Sep. 28, 2004,entitled “Video and Graphics System with a Single-Port RAM UsedSimilarly as a Dual-Port RAM,” and U.S. patent application Ser. No.09/642,458 entitled “Video and Graphics System with an Integrated SystemBridge Controller,” all filed Aug. 18, 2000.

FIELD OF THE INVENTION

The present invention relates generally to integrated circuits andsystems, and more particularly to a system for processing and displayingvideo and graphics.

BACKGROUND OF THE INVENTION

Video and graphics systems are typically used in television controlelectronics, such as set top boxes, integrated digital TVs, and homenetwork computers. Video and graphics systems may include components forreceiving compressed and uncompressed graphics and video, and forprocessing the received graphics and video into displayable format.Video and graphics systems tend to increase in size and complexity asadditional features are added.

This application includes references to both graphics and video, whichreflects in certain ways the structure of the hardware itself. Thissplit does not, however, imply the existence of any fundamentaldifference between graphics and video, and in fact much of thefunctionality is common to both. Graphics as used herein may includegraphics, text and video.

SUMMARY OF THE INVENTION

The system of the present invention preferably includes capabilities forMPEG Transport, MPEG video/audio decoding and/or compositing of graphicsinto blended graphics. The system of the present invention may also bereferred to as an audiovisual system, a graphics display system or amedia processing system.

The system preferably includes one or more of the following features:

The system preferably composites graphics windows in parallel andpreferably uses a single-port RAM similarly as a dual-port RAM. Thesystem preferably also includes provisions for using reduced memory sizeand bandwidth when displaying HDTV signals in either HDTV format or SDTVformat.

The system preferably accepts MPEG Transport streams on three concurrentinputs for MPEG Transport layer parsing and decoding of MPEG video andMPEG or Dolby Digital audio decoding. The MPEG Transport streamsreceived by the system preferably includes two in-band Transport streamsand one out-of-band Transport stream. The system preferably providesfull support for both in-band and out-of-band streams concurrently. Thesystem may display MPEG video in two simultaneous in-band streams inpicture-in-picture (PIP) format.

The system preferably supports both SDTV and HDTV color spaces for bothdecode and display. The system may also provide conversion between themand conversion of those color spaces to RGB color space. This capabilitypreferably provides proper color display in many combinations, includingSD content (YC_(B)C_(R)) on HD displays (YP_(R)P_(B)), HD content on SDdisplays, and either type of content on RGB displays. The graphicsdisplay preferably is also converted appropriately to match the selecteddisplay type.

The system of the present invention preferably implements an efficientcombination of hardware, firmware and software. The system preferablyimplements in hardware those functions with fixed functionalrequirements and very high real-time throughput requirements which maybe impractical or expensive to meet with either on-board processors or aCPU. The functions implemented in hardware may include variable-lengthdecode (Huffman decode), motion compensation, Inverse Discrete CosineTransform (IDCT), and memory address generation in the MPEG videodecoder. The functions implemented in hardware may also include graphicscompositing, display pipelines, MPEG and Dolby audio decoding, videoscaling, and analog video digitizing and decoding.

The system preferably implements in firmware, e.g., on-chip RISCprocessors, those functions with complex or variable logic and slightlylower real-time throughput requirements, including slice and higherlayers of MPEG video decoding, error handling in digital video streams,and 3D and 2D graphics bit map acceleration in the graphics acceleratorfor current and future special effects.

The system preferably utilizes an external central processing unit (CPU)to implement in software higher level functions which may have much morecomplex logic and variable functions and where adequate real-timeperformance may be obtained while running multiple concurrent softwaretasks.

The system preferably is designed for minimum total system cost,including all video, audio, transport, graphics, system I/O, memory forall functions, and the interfacing CPU. Low cost is achieved byintegration of hardware functions, efficient use of memory, andefficient utilization of CPU activity.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an integrated circuit graphics displaysystem according to a presently preferred embodiment of the invention;

FIG. 2 is a block diagram of certain functional blocks of the system;

FIG. 3 is a block diagram of an alternate embodiment of the system ofFIG. 2 that incorporates an on-chip I/O bus;

FIG. 4 is a functional block diagram of exemplary video and graphicsdisplay pipelines;

FIG. 5 is a more detailed block diagram of the graphics and videopipelines of the system;

FIG. 6 is a map of an exemplary window descriptor for describinggraphics windows and solid surfaces;

FIG. 7 is a flow diagram of an exemplary process for sorting windowdescriptors in a window controller;

FIG. 8 is a flow diagram of a graphics window control data passingmechanism and a color look-up table loading mechanism;

FIG. 9 is a state diagram of a state machine in a graphics converterthat may be used during processing of header packets;

FIG. 10 is a block diagram of an embodiment of a display engine;

FIG. 11 is a block diagram of an embodiment of a color look-up table(CLUT);

FIG. 12 is a timing diagram of signals that may be used to load a CLUT;

FIG. 13 is a block diagram illustrating exemplary graphics line buffers;

FIG. 14 is a flow diagram of a system for controlling the graphics linebuffers of FIG. 13;

FIG. 15 is a representation of left scrolling using a window softhorizontal scrolling mechanism;

FIG. 16 is a representation of right scrolling using a window softhorizontal scrolling mechanism;

FIG. 17 is a flow diagram illustrating a system that uses graphicselements or glyphs for anti-aliased text and graphics applications;

FIG. 18 is a block diagram of certain functional blocks of a videodecoder for performing video synchronization;

FIG. 19 is a block diagram of an embodiment of a chroma-locked samplerate converter (SRC);

FIG. 20 is a block diagram of an alternate embodiment of thechroma-locked SRC of FIG. 19;

FIG. 21 is a block diagram of an exemplary line-locked SRC;

FIG. 22 is a block diagram of an exemplary time base corrector (TBC);

FIG. 23 is a flow diagram of a process that employs a TBC to synchronizean input video to a display clock;

FIG. 24 is a flow diagram of a process for video scaling in whichdownscaling is performed prior to capture of video in memory andupscaling is performed after reading video data out of memory;

FIG. 25 is a detailed block diagram of components used during videoscaling with signal paths involved in downscaling;

FIG. 26 is a detailed block diagram of components used during videoscaling with signal paths involved in upscaling;

FIG. 27 is a detailed block diagram of components that may be usedduring video scaling with signal paths indicated for both upscaling anddownscaling;

FIG. 28 is a flow diagram of an exemplary process for blending graphicsand video surfaces;

FIG. 29 is a flow diagram of an exemplary process for blending graphicswindows into a combined blended graphics output;

FIG. 30 is a flow diagram of an exemplary process for blending graphics,video and background color;

FIG. 31 is a block diagram of a polyphase filter that performs bothanti-flutter filtering and vertical scaling of graphics windows;

FIG. 32 is a functional block diagram of an exemplary memory servicerequest and handling system with dual memory controllers;

FIG. 33 is a functional block diagram of an implementation of a realtime scheduling system;

FIG. 34 is a timing diagram of an exemplary CPU servicing mechanism thathas been implemented using real time scheduling;

FIG. 35 is a timing diagram that illustrates certain principles ofcritical instant analysis for an implementation of real time scheduling;

FIG. 36 is a flow diagram illustrating servicing of requests accordingto the priority of the task;

FIG. 37 is a block diagram of a graphics accelerator, which may becoupled to a CPU and a memory controller;

FIG. 38 is a block diagram of an integrated circuit chip, which embodiesthe system of the present invention, coupled to the CPU and otherdevices;

FIG. 39 is a block diagram of the integrated circuit chip in oneembodiment of the present invention;

FIG. 40 is a block diagram of the integrated circuit chip in oneembodiment of the present invention;

FIG. 41 is a block diagram that illustrates distribution of MPEGTransport streams in one embodiment of present invention;

FIG. 42 is a block diagram of one embodiment of a data transport;

FIG. 43 is a block diagram of another embodiment of a data transport;

FIG. 44 is a block diagram of a video transport;

FIG. 45 is a block diagram of first and second decode row paths withwhich four macroblock rows may be decoded simultaneously;

FIG. 46 is a block diagram of a video RISC;

FIG. 47 is a context flow graph of the operation of one of the two rowdecode paths;

FIG. 48 is a block diagram which illustrates providing an SDTV videooutput while displaying an HDTV video;

FIG. 49 is a block diagram of MPEG video decoding stages in oneembodiment;

FIG. 50 is a block diagram of MPEG video decoding stages in anotherembodiment;

FIG. 51 is a process diagram illustrating frame-prediction forI-pictures and P-pictures;

FIG. 52 is a process diagram illustrating field-prediction in aframe-picture;

FIG. 53 is a process diagram illustrating prediction of the firstfield-picture;

FIG. 54 is a process diagram illustrating prediction of the “bottomfield” second field-picture;

FIG. 55 is a process diagram illustrating prediction of the “top field”second field-picture;

FIG. 56 is a process diagram illustrating prediction of B field picturesor B frame pictures;

FIG. 57 is a process diagram illustrating frame prediction forB-pictures.

FIG. 58 is a block diagram of image organization in SDRAM;

FIG. 59 is a block diagram of an audio decode processor (ADP);

FIG. 60 is a block diagram of a system bridge controller;

FIG. 61 is a process diagram that illustrates how graphics windows areblended together into blended graphics and composited with video;

FIG. 62 is a block diagram of integrated circuit containing a displayengine, the integrated circuit is coupled to external memory andtelevision;

FIG. 63 is a block diagram of a window control block;

FIG. 64 is a block diagram of window controller state machines;

FIG. 65 is a state diagram of a window descriptor state machine;

FIG. 66 is a state diagram of a window state machine;

FIG. 67 is a state diagram of a window state machine;

FIG. 68. is a priority diagram that illustrates window arbitrationpriorities;

FIG. 69 is a block diagram of a display engine in one embodiment of thepresent invention;

FIG. 70 is a process diagram that illustrates conversion stages ofgraphics data in a graphics converter;

FIG. 71 is block diagram of a two-port SRAM;

FIG. 72 is a block diagram of a single-port SRAM that functionsequivalently to a dual-port SRAM;

FIG. 73 is a block diagram of a graphics filter coupled to graphics linebuffers; and

FIG. 74 is a block diagram of a filter core in the graphics filter.

DETAILED DESCRIPTION

I. Graphics Display System Architecture

Referring to FIG. 1, the graphics display system according to thepresent invention is preferably contained in an integrated circuit 10.The integrated circuit may include inputs 12 for receiving video signals14, a bus 20 for connecting to a CPU 22, a bus 24 for transferring datato and from memory 28, and an output 30 for providing a video outputsignal 32. The system may further include an input 26 for receivingaudio input 34 and an output 27 for providing audio output 36.

The graphic display system accepts video input signals that may includeanalog video signals, digital video signals, or both. The analog signalsmay be, for example, NTSC, PAL and SECAM signals or any otherconventional type of analog signal. The digital signals may be in theform of decoded MPEG signals or other format of digital video. In analternate embodiment, the system includes an on-chip decoder fordecoding the MPEG or other digital video signals input to the system.Graphics data for display is produced by any suitable graphics librarysoftware, such as Direct Draw marketed by Microsoft Corporation, and isread from the CPU 22 into the memory 28. The video output signals 32 maybe analog signals, such as composite NTSC, PAL, Y/C (S-video), SECAM orother signals that include video and graphics information. In analternate embodiment, the system provides serial digital video output toan on-chip or off-chip serializer that may encrypt the output.

The graphics display system memory 28 is preferably a unifiedsynchronous dynamic random access memory (SDRAM) that is shared by thesystem, the CPU 22 and other peripheral components. In the preferredembodiment the CPU uses the unified memory for its code and data whilethe graphics display system performs all graphics, video and audiofunctions assigned to it by software. The amount of memory and CPUperformance are preferably tunable by the system designer for thedesired mix of performance and memory cost. In the preferred embodiment,a set-top box is implemented with SDRAM that supports both the CPU andgraphics.

Referring to FIG. 2, the graphics display system preferably includes avideo decoder 50, video scaler 52, memory controller 54, windowcontroller 56, display engine 58, video compositor 60, and video encoder62. The system may optionally include a graphics accelerator 64 and anaudio engine 66. The system may display graphics, passthrough video,scaled video or a combination of the different types of video andgraphics. Passthrough video includes digital or analog video that is notcaptured in memory. The passthrough video may be selected from theanalog video or the digital video by a multiplexer. Bypass video, whichmay come into the chip on a separate input, includes analog video thatis digitized off-chip into conventional YUV (luma chroma) format by anysuitable decoder, such as the BT829 decoder, available from BrooktreeCorporation, San Diego, Calif. The YUV format may also be referred to asYCrCb format where Cr and Cb are equivalent to U and V, respectively.

The video decoder (VDEC) 50 preferably digitizes and processes analoginput video to produce internal YUV component signals with separatedluma and chroma components. In an alternate embodiment, the digitizedsignals may be processed in another format, such as RGB. The VDEC 50preferably includes a sample rate converter 70 and a time base corrector72 that together allow the system to receive non-standard video signals,such as signals from a VCR. The time base corrector 72 enables the videoencoder to work in passthrough mode, and corrects digitized analog videoin the time domain to reduce or prevent jitter.

The video scaler 52 may perform both downscaling and upscaling ofdigital video and analog video as needed. In the preferred embodiment,scale factors may be adjusted continuously from a scale factor of muchless than one to a scale factor of four. With both analog and digitalvideo input, either one may be scaled while the other is displayed fullsize at the same time as passthrough video. Any portion of the input maybe the source for video scaling. To conserve memory and bandwidth, thevideo scaler preferably downscales before capturing video frames tomemory, and upscales after reading from memory, but preferably does notperform both upscaling and downscaling at the same time.

The memory controller 54 preferably reads and writes video and graphicsdata to and from memory by using burst accesses with burst lengths thatmay be assigned to each task. The memory is any suitable memory such asSDRAM. In the preferred embodiment, the memory controller includes twosubstantially similar SDRAM controllers, one primarily for the CPU andthe other primarily for the graphics display system, while eithercontroller may be used for any and all of these functions.

The graphics display system preferably processes graphics data usinglogical windows, also referred to as viewports, surfaces, sprites, orcanvasses, that may overlap or cover one another with arbitrary spatialrelationships. Each window is preferably independent of the others. Thewindows may consist of any combination of image content, includinganti-aliased text and graphics, patterns, GIF images, JPEG images, livevideo from MPEG or analog video, three dimensional graphics, cursors orpointers, control panels, menus, tickers, or any other content, all orsome of which may be animated.

Graphics windows are preferably characterized by window descriptors.Window descriptors are data structures that describe one or moreparameters of the graphics window. Window descriptors may include, forexample, image pixel format, pixel color type, alpha blend factor,location on the screen, address in memory, depth order on the screen, orother parameters. The system preferably supports a wide variety of pixelformats, including RGB 16, RGB 15, YUV 4:2:2 (ITU-R 601), CLUT2, CLUT4,CLUT8 or others.

In addition to each window having its own alpha blend factor, each pixelin the preferred embodiment has its own alpha value. In the preferredembodiment, window descriptors are not used for video windows. Instead,parameters for video windows, such as memory start address and windowsize are stored in registers associated with the video compositor.

In operation, the window controller 56 preferably manages both the videoand graphics display pipelines. The window controller preferablyaccesses graphics window descriptors in memory through a direct memoryaccess (DMA) engine 76. The window controller may sort the windowdescriptors according to the relative depth of their correspondingwindows on the display. For graphics windows, the window controllerpreferably sends header information to the display engine at thebeginning of each window on each scan line, and sends window headerpackets to the display engine as needed to display a window. For video,the window controller preferably coordinates capture of non-passthroughvideo into memory, and transfer of video between memory and the videocompositor.

The display engine 58 preferably takes graphics information from memoryand processes it for display. The display engine preferably converts thevarious formats of graphics data in the graphics windows into YUVcomponent format, and blends the graphics windows to create blendedgraphics output having a composite alpha value that is based on alphavalues for individual graphics windows, alpha values per pixel, or both.In the preferred embodiment, the display engine transfers the processedgraphics information to memory buffers that are configured as linebuffers. In an alternate embodiment, the buffer may include a framebuffer. In another alternate embodiment, the output of the displayengine is transferred directly to a display or output block withoutbeing transferred to memory buffers.

The video compositor 60 receives one or more types of data, such asblended graphics data, video window data, passthrough video data andbackground color data, and produces a blended video output. The videoencoder 62 encodes the blended video output from the video compositorinto any suitable display format such as composite NTSC, PAL, Y/C(S-video), SECAM or other signals that may include video information,graphics information, or a combination of video and graphicsinformation. In an alternate embodiment, the video encoder converts theblended video output of the video compositor into serial digital videooutput using an on-chip or off chip serializer that may encrypt theoutput.

The graphics accelerator 64 preferably performs graphics operations thatmay require intensive CPU processing, such as operations on threedimensional graphics images. The graphics accelerator may beprogrammable. The audio engine 66 preferably supports applications thatcreate and play audio locally within a set-top box and allow mixing ofthe locally created audio with audio from a digital audio source, suchas MPEG or Dolby, and with digitized analog audio. The audio engine alsopreferably supports applications that capture digitized baseband audiovia an audio capture port and store sounds in memory for later use, orthat store audio to memory for temporary buffering in order to delay theaudio for precise lip-syncing when frame-based video time correction isenabled.

Referring to FIG. 3, in an alternate embodiment of the presentinvention, the graphics display system further includes an I/O bus 74connected between the CPU 22, memory 28 and one or more of a widevariety of peripheral devices, such as flash memory, ROM, MPEG decoders,cable modems or other devices. The on-chip I/O bus 74 of the presentinvention preferably eliminates the need for a separate interfaceconnection, sometimes referred in the art to as a north bridge. The I/Obus preferably provides high speed access and data transfers between theCPU, the memory and the peripheral devices, and may be used to supportthe full complement of devices that may be used in a full featuredset-top box or digital TV. In the preferred embodiment, the I/O bus iscompatible with the 68000 bus definition, including both active DSACKand passive DSACK (e.g., ROM/flash devices), and it supports externalbus masters and retry operations as both master and slave. The buspreferably supports any mix of 32-bit, 16-bit and 8-bit devices, andoperates at a clock rate of 33 MHz. The clock rate is preferablyasynchronous with (not synchronized with) the CPU clock to enableindependent optimization of those subsystems.

Referring to FIG. 4, the graphics display system generally includes agraphics display pipeline 80 and a video display pipeline 82. Thegraphics display pipeline preferably contains functional blocks,including window control block 84, DMA (direct memory access) block 86,FIFO (first-in-first-out memory) block 88, graphics converter block 90,color look up table (CLUT) block 92, graphics blending block 94, staticrandom access memory (SRAM) block 96, and filtering block 98. The systempreferably spatially processes the graphics data independently of thevideo data prior to blending.

In operation, the window control block 84 obtains and stores graphicswindow descriptors from memory and uses the window descriptors tocontrol the operation of the other blocks in the graphics displaypipeline. The windows may be processed in any order. In the preferredembodiment, on each scan line, the system processes windows one at atime from back to front and from the left edge to the right edge of thewindow before proceeding to the next window. In an alternate embodiment,two or more graphics windows may be processed in parallel. In theparallel implementation, it is possible for all of the windows to beprocessed at once, with the entire scan line being processed left toright. Any number of other combinations may also be implemented, such asprocessing a set of windows at a lower level in parallel, left to right,followed by the processing of another set of windows in parallel at ahigher level.

The DMA block 86 retrieves data from memory 110 as needed to constructthe various graphics windows according to addressing informationprovided by the window control block. Once the display of a windowbegins, the DMA block preferably retains any parameters that may beneeded to continue to read required data from memory. Such parametersmay include, for example, the current read address, the address of thestart of the next lines, the number of bytes to read per line, and thepitch. Since the pipeline preferably includes a vertical filter blockfor anti-flutter and scaling purposes, the DMA block preferably accessesa set of adjacent display lines in the same frame, in both fields. Ifthe output of the system is NTSC or other form of interlaced video, theDMA preferably accesses both fields of the interlaced final displayunder certain conditions, such as when the vertical filter and scalingare enabled. In such a case, all lines, not just those from the currentdisplay field, are preferably read from memory and processed duringevery display field. In this embodiment, the effective rate of readingand processing graphics is equivalent to that of a non-interlaceddisplay with a frame rate equal to the field rate of the interlaceddisplay.

The FIFO block 88 temporarily stores data read from the memory 110 bythe DMA block 86, and provides the data on demand to the graphicsconverter block 90. The FIFO may also serve to bridge a boundary betweendifferent clock domains in the event that the memory and DMA operateunder a clock frequency or phase that differs from the graphicsconverter block 90 and the graphics blending block 94. In an alternateembodiment, the FIFO block is not needed. The FIFO block may beunnecessary, for example, if the graphics converter block processes datafrom memory at the rate that it is read from the memory and the memoryand conversion functions are in the same clock domain.

In the preferred embodiment, the graphics converter block 90 takes rawgraphics data from the FIFO block and converts it to YUValpha (YUVa)format. Raw graphics data may include graphics data from memory that hasnot yet been processed by the display engine. One type of YUVa formatthat the system may use includes YUV 4:2:2 (i.e. two U and V samples forevery four Y samples) plus an 8-bit alpha value for every pixel, whichoccupies overall 24 bits per pixel. Another suitable type of YUVa formatincludes YUV 4:4:4 plus the 8-bit alpha value per pixel, which occupies32 bits per pixel. In an alternate embodiment, the graphics convertermay convert the raw graphics data into a different format, such asRGBalpha.

The alpha value included in the YUVa output may depend on a number offactors, including alpha from chroma keying in which a transparent pixelhas an alpha equal to zero, alpha per CLUT entry, alpha from Y (luma),or alpha per window where one alpha value characterizes all of thecontents of a given window.

The graphics converter block 90 preferably accesses the CLUT 92 duringconversion of CLUT formatted raw graphics data. In one embodiment of thepresent invention, there is only one CLUT. In an alternate embodiment,multiple CLUTs are used to process different graphics windows havinggraphics data with different CLUT formats. The CLUT may be rewritten byretrieving new CLUT data via the DMA block when required. In practice,it typically takes longer to rewrite the CLUT than the time available ina horizontal blanking interval, so the system preferably allows onehorizontal line period to change the CLUT. Non-CLUT images may bedisplayed while the CLUT is being changed. The color space of theentries in the CLUT is preferably in YUV but may also be implemented inRGB.

The graphics blending block 94 receives output from the graphicsconverter block 90 and preferably blends one window at a time along theentire width of one scan line, with the back-most graphics window beingprocessed first. The blending block uses the output from the converterblock to modify the contents of the SRAM 96. The result of each pixelblend operation is a pixel in the SRAM that consists of the weighted sumof the various graphics layers up to and including the present one, andthe appropriate alpha blend value for the video layers, taking intoaccount the graphics layers up to and including the present one.

The SRAM 96 is preferably configured as a set of graphics line buffers,where each line buffer corresponds to a single display line. Theblending of graphics windows is preferably performed one graphics windowat a time on the display line that is currently being composited into aline buffer. Once the display line in a line buffer has been completelycomposited so that all the graphics windows on that display line havebeen blended, the line buffer is made available to the filtering block98.

The filtering block 98 preferably performs both anti-flutter filtering(AFF) and vertical sample rate conversion (SRC) using the same filter.This block takes input from the line buffers and performs finite impulseresponse polyphase filtering on the data. While anti-flutter filteringand vertical axis SRC are done in the vertical axis, there may bedifferent functions, such as horizontal SRC or scaling that areperformed in the horizontal axis. In the preferred embodiment, thefilter takes input from only vertically adjacent pixels at one time. Itmultiplies each input pixel times a specified coefficient, and sums theresult to produce the output. The polyphase action means that thecoefficients, which are samples of an approximately continuous impulseresponse, may be selected from a different fractional-pixel phase of theimpulse response every pixel. In an alternate embodiment, where thefilter performs horizontal scaling, appropriate coefficients areselected for a finite impulse response polyphase filter to perform thehorizontal scaling. In an alternate embodiment, both horizontal andvertical filtering and scaling can be performed.

The video display pipeline 82 may include a FIFO block 100, an SRAMblock 102, and a video scaler 104. The video display pipeline portion ofthe architecture is similar to that of the graphics display pipeline,and it shares some elements with it. In the preferred embodiment, thevideo pipeline supports up to one scaled video window per scan line, onepassthrough video window, and one background color, all of which arelogically behind the set of graphics windows. The order of thesewindows, from back to front, is preferably fixed as background color,then passthrough video, then scaled video.

The video windows are preferably in YUV format, although they may be ineither 4:2:2 or 4:2:0 variants or other variants of YUV, oralternatively in other formats such as RGB. The scaled video window maybe scaled up in both directions by the display engine, with a factorthat can range up to four in the preferred embodiment. Unlike graphics,the system generally does not have to correct for square pixel aspectratio with video. The scaled video window may be alpha blended intopassthrough video and a background color, preferably using a constantalpha value for each video signal.

The FIFO block 100 temporarily stores captured video windows fortransfer to the video scaler 104. The video scaler preferably includes afilter that performs both upscaling and downscaling. The scaler functionmay be a set of two polyphase SRC functions, one for each dimension. Thevertical SRC may be a four-tap filter with programmable coefficients ina fashion similar to the vertical filter in the graphics pipeline, andthe horizontal filter may use an 8-tap SRC, also with programmablecoefficients. In an alternate embodiment, a shorter horizontal filter isused, such as a 4-tap horizontal SRC for the video upscaler. Since thesame filter is preferably used for downscaling, it may be desirable touse more taps than are strictly needed for upscaling to accommodate lowpass filtering for higher quality downscaling.

In the preferred embodiment, the video pipeline uses a separate windowcontroller and DMA. In an alternate embodiment, these elements may beshared. The FIFOs are logically separate but may be implemented in acommon SRAM.

The video compositor block 108 blends the output of the graphics displaypipeline, the video display pipeline, and passthrough video. Thebackground color is preferably blended as the lowest layer on thedisplay, followed by passthrough video, the video window and blendedgraphics. In the preferred embodiment, the video compositor compositeswindows directly to the screen line-by-line at the time the screen isdisplayed, thereby conserving memory and bandwidth. The video compositormay include, but preferably does not include, display frame buffers,double-buffered displays, off-screen bit maps, or blitters.

Referring to FIG. 5, the display engine 58 preferably includes graphicsFIFO 132, graphics converter 134, RGB-to-YUV converter 136,YUV-444-to-YUV422 converter 138 and graphics blender 140. The graphicsFIFO 132 receives raw graphics data from memory through a graphics DMA124 and passes it to the graphics converter 134, which preferablyconverts the raw graphics data into YUV 4:4:4 format or other suitableformat. A window controller 122 controls the transfer of raw graphicsdata from memory to the graphics converter 132. The graphics converterpreferably accesses the RGB-to-YUV converter 136 during conversion ofRGB formatted data and the graphics CLUT 146 during conversion of CLUTformatted data. The RGB-to-YUV converter is preferably a color spaceconverter that converts raw graphics data in RGB space to graphics datain YUV space. The graphics CLUT 146 preferably includes a CLUT 150,which stores pixel values for CLUT-formatted graphics data, and a CLUTcontroller 152, which controls operation of the CLUT.

The YUV444-to-YUV422 converter 138 converts graphics data from YUV 4:4:4format to YUV 4:2:2 format. The term YUV 4:4:4 means, as isconventional, that for every four horizontally adjacent samples, thereare four Y values, four U values, and four V values; the term YUV 4:2:2means, as is conventional, that for every four samples, there are four Yvalues, two U values and two V values. The YUV444-to-YUV422 converter138 is preferably a UV decimator that sub-samples U and V from foursamples per every four samples of Y to two samples per every foursamples of Y.

Graphics data in YUV 4:4:4 format and YUV 4:2:2 format preferably alsoincludes four alpha values for every four samples. Graphics data in YUV4:4:4 format with four alpha values for every four samples may bereferred to as being in aYUV 4:4:4:4 format; graphics data in YUV 4:2:2format with four alpha values for every four samples may be referred toas being in aYUV 4:4:2:2 format.

The YUV444-to-YUV422 converter may also perform low-pass filtering of UVand alpha. For example, if the graphics data with YUV 4:4:4 format hashigher than desired frequency content, a low pass filter in theYUV444-to-YUV422 converter may be turned on to filter out high frequencycomponents in the U and V signals, and to perform matched filtering ofthe alpha values.

The graphics blender 140 blends the YUV 4:2:2 signals together,preferably one line at a time using alpha blending, to create a singleline of graphics from all of the graphics windows on the current displayline. The filter 170 preferably includes a single 4-tap verticalpolyphase graphics filter 172, and a vertical coefficient memory 174.The graphics filter may perform both anti-flutter filtering and verticalscaling. The filter preferably receives graphics data from the displayengine through a set of seven line buffers 59, where four of the sevenline buffers preferably provide data to the taps of the graphics filterat any given time.

In the preferred embodiment, the system may receive video input thatincludes one decoded MPEG video in ITU-R 656 format and one analog videosignal. The ITU-R 656 decoder 160 processes the decoded MPEG video toextract timing and data information. In one embodiment, an on-chip videodecoder (VDEC) 50 converts the analog video signal to a digitized videosignal. In an alternate embodiment, an external VDEC such as theBrooktree BT829 decoder converts the analog video into digitized analogvideo and provides the digitized video to the system as bypass video130.

Analog video or MPEG video may be provided to the video compositor aspassthrough video. Alternatively, either type of video may be capturedinto memory and provided to the video compositor as a scaled videowindow. The digitized analog video signals preferably have a pixelsample rate of 13.5 MHz, contain a 16 bit data stream in YUV 4:2:2format, and include timing signals such as top field and vertical syncsignals.

The VDEC 50 includes a time base corrector (TBC) 72 comprising a TBCcontroller 164 and a FIFO 166. To provide passthrough video that issynchronized to a display clock preferably without using a frame buffer,the digitized analog video is corrected in the time domain in the TBC 72before being blended with other graphics and video sources. During timebase correction, the video input which runs nominally at 13.5 MHZ issynchronized with the display clock which runs nominally at 13.5 MHZ atthe output; these two frequencies that are both nominally 13.5 MHz arenot necessarily exactly the same frequency. In the TBC, the video outputis preferably offset from the video input by a half scan line per field.

A capture FIFO 158 and a capture DMA 154 preferably capture thedigitized analog video signals and MPEG video. The SDRAM controller 126provides captured video frames to the external SDRAM. A video DMA 144transfers the captured video frames to a video FIFO 148 from theexternal SDRAM.

The digitized analog video signals and MPEG video are preferably scaleddown to less than 100% prior to being captured and are scaled up to morethan 100% after being captured. The video scaler 52 is shared by bothupscale and downscale operations. The video scaler preferably includes amultiplexer 176, a set of line buffers 178, a horizontal and verticalcoefficient memory 180 and a scaler engine 182. The scaler engine 182preferably includes a set of two polyphase filters, one for each ofhorizontal and vertical dimensions.

The vertical filter preferably includes a four-tap filter withprogrammable filter coefficients. The horizontal filter preferablyincludes an eight-tap filter with programmable filter coefficients. Inthe preferred embodiment, three line buffers 178 supply video signals tothe scaler engine 182. The three line buffers 178 preferably are 720×16two port SRAM. For vertical filtering, the three line buffers 178 mayprovide video signals to three of the four taps of the four-tap verticalfilter while the video input provides the video signal directly to thefourth tap. For horizontal filtering, a shift register having eightcells in series may be used to provide inputs to the eight taps of thehorizontal polyphase filter, each cell providing an input to one of theeight taps.

For downscaling, the multiplexer 168 preferably provides a video signalto the video scaler prior to capture. For upscaling, the video FIFO 148provides a video signal to the video scaler after capture. Since thevideo scaler 52 is shared between downscaling and upscaling filtering,downscaling and upscaling operations are not performed at the same timein this particular embodiment.

In the preferred embodiment, the video compositor 60 blends signals fromup to four different sources, which may include blended graphics fromthe filter 170, video from a video FIFO 148, passthrough video from amultiplexer 168, and background color from a background color module184. Alternatively, various numbers of signals may be composited,including, for example, two or more video windows. The video compositorpreferably provides final output signal to the data size converter 190,which serializes the 16-bit word sample into an 8-bit word sample attwice the clock frequency, and provides the 8-bit word sample to thevideo encoder 62.

The video encoder 62 encodes the provided YUV 4:2:2 video data andoutputs it as an output of the graphics display system in any desiredanalog or digital format.

II. Window Descriptor and Solid Surface Description

Often in the creation of graphics displays, the artist or applicationdeveloper has a need to include rectangular objects on the screen, withthe objects having a solid color and a uniform alpha blend factor (alphavalue). These regions (or objects) may be rendered with other displayedobjects on top of them or beneath them. In conventional graphicsdevices, such solid color objects are rendered using the number ofdistinct pixels required to fill the region. It may be advantageous interms of memory size and memory bandwidth to render such objects on thedisplay directly, without expending the memory size or bandwidthrequired in conventional approaches.

In the preferred embodiment, video and graphics are displayed on regionsreferred to as windows. Each window is preferably a rectangular area ofscreen bounded by starting and ending display lines and starting andending pixels on each display line. Raw graphics data to be processedand displayed on a screen preferably resides in the external memory. Inthe preferred embodiment, a display engine converts raw graphics datainto a pixel map with a format that is suitable for display.

In one embodiment of the present invention, the display engineimplements graphics windows of many types directly in hardware. Each ofthe graphics windows on the screen has its own value of variousparameters, such as location on the screen, starting address in memory,depth order on the screen, pixel color type, etc. The graphics windowsmay be displayed such that they may overlap or cover each other, witharbitrary spatial relationships.

In the preferred embodiment, a data structure called a window descriptorcontains parameters that describe and control each graphics window. Thewindow descriptors are preferably data structures for representinggraphics images arranged in logical surfaces, or windows, for display.Each data structure preferably includes a field indicating the relativedepth of the logical surface on the display, a field indicating thealpha value for the graphics in the surface, a field indicating thelocation of the logical surface on the display, and a field indicatingthe location in memory where graphics image data for the logical surfaceis stored.

All of the elements that make up any given graphics display screen arepreferably specified by combining all of the window descriptors of thegraphics windows that make up the screen into a window descriptor list.At every display field time or a frame time, the display engineconstructs the display image from the current window descriptor list.The display engine composites all of the graphics windows in the currentwindow descriptor list into a complete screen image in accordance withthe parameters in the window descriptors and the raw graphics dataassociated with the graphics windows.

With the introduction of window descriptors and real-time composition ofgraphics windows, a graphics window with a solid color and fixedtranslucency may be described entirely in a window descriptor havingappropriate parameters. These parameters describe the color and thetranslucency (alpha) just as if it were a normal graphics window. Theonly difference is that there is no pixel map associated with thiswindow descriptor. The display engine generates a pixel map accordinglyand performs the blending in real time when the graphics window is to bedisplayed.

For example, a window consisting of a rectangular object having aconstant color and a constant alpha value may be created on a screen byincluding a window descriptor in the window descriptor list. In thiscase, the window descriptor indicates the color and the alpha value ofthe window, and a null pixel format, i.e., no pixel values are to beread from memory. Other parameters indicate the window size and locationon the screen, allowing the creation of solid color windows with anysize and location. Thus, in the preferred embodiment, no pixel map isrequired, memory bandwidth requirements are reduced and a window of anysize may be displayed.

Another type of graphics window that the window descriptors preferablydescribe is an alpha-only type window. The alpha-only type windowspreferably use a constant color and preferably have graphics data with2, 4 or 8 bits per pixel. For example, an alpha-4 format may be analpha-only format used in one of the alpha-only type windows. Thealpha-4format specifies the alpha-only type window with alpha blendvalues having four bits per pixel. The alpha-only type window may beparticularly useful for displaying anti-aliased text.

A window controller preferably controls transfer of graphics displayinformation in the window descriptors to the display engine. In oneembodiment, the window controller has internal memory to store eightwindow descriptors. In other embodiments, the window controller may havememory allocated to store more or less window descriptors. The windowcontroller preferably reads the window descriptors from external memoryvia a direct memory access (DMA) module.

The DMA module may be shared by both paths of the display pipeline aswell as some of the control logic, such as the window controller and theCLUT. In order to support the display pipeline, the DMA modulepreferably has three channels where the graphics pipeline and the videopipeline use separate DMA modules. These may include window descriptorread, graphics data read and CLUT read. Each channel has externallyaccessible registers to control the start address and the number ofwords to read.

Once the DMA module has completed a transfer as indicated by its startand length registers, it preferably activates a signal that indicatesthe transfer is complete. This allows the DMA module that sets upoperations for that channel to begin setting up of another transfer. Inthe case of graphics data reads, the window controller preferably setsup a transfer of one line of graphics pixels and then waits for the DMAcontroller to indicate that the transfer of that line is complete beforesetting up the transfer of the next line, or of a line of anotherwindow.

Referring to FIG. 6, each window descriptor preferably includes four32-bit words (labeled Word 0 through Word 3) containing graphics windowdisplay information. Word 0 preferably includes a window operationparameter, a window format parameter and a window memory start address.The window operation parameter preferably is a 2-bit field thatindicates which operation is to be performed with the window descriptor.When the window operation parameter is 00b, the window descriptorperforms a normal display operation and when it is 01b, the windowdescriptor performs graphics color look-up table (“CLUT”) re-loading.The window operation parameter of 10b is preferably not used. The windowoperation parameter of 11b preferably indicates that the windowdescriptor is the last of a sequence of window descriptors in memory.

The window format parameter preferably is a 4-bit field that indicates adata format of the graphics data to be displayed in the graphics window.The data formats corresponding to the window format parameter isdescribed in Table 1 below.

TABLE 1 Graphics Data Formats Data win_format Format Data FormatDescription 0000b RGB16 5-BIT RED, 6-BIT GREEN, 5-BIT BLUE 0001b RGB15+1RGB15 plus one bit alpha (keying) 0010b RGBA4444 4-BIT RED, GREEN, BLUE,ALPHA 0100b CLUT2 2-bit CLUT with YUV and alpha in table 0101b CLUT44-bit CLUT with YUV and alpha in table 0110b CLUT8 8-bit CLUT with YUVand alpha in table 0111b ACLUT16 8-BIT ALPHA, 8-BIT CLUT INDEX 1000bALPHA0 Single win_alpha and single RGB win_color 1001b ALPHA2 2-bitalpha with single RGB win_color 1010b ALPHA4 4-bit alpha with single RGBwin_color 1011b ALPHA8 8-bit alpha with single RGB win_color 1100bYUV422 U and V are sampled at half the rate of Y 1111b RESERVED Specialcoding for blank line in new header, i.e., indicates an empty line

The window memory start address preferably is a 26-bit data field thatindicates a starting memory address of the graphics data of the graphicswindow to be displayed on the screen. The window memory start addresspoints to the first address in the corresponding external SDRAM which isaccessed to display data on the graphics window defined by the windowdescriptor. When the window operation parameter indicates the graphicsCLUT reloading operation, the window memory start address indicates astarting memory address of data to be loaded into the graphics CLUT.

Word 1 in the window descriptor preferably includes a window layerparameter, a window memory pitch value and a window color value. Thewindow layer parameter is preferably a 4-bit data indicating the orderof layers of graphics windows. Some of the graphics windows may bepartially or completely stacked on top of each other, and the windowlayer parameter indicates the stacking order. The window layer parameterpreferably indicates where in the stack the graphics window defined bythe window descriptor should be placed.

In the preferred embodiment, a graphics window with a window layerparameter of 0000b is defined as the bottom most layer, and a graphicswindow with a window layer parameter of 1111b is defined as the top mostlayer. Preferably, up to eight graphics windows may be processed in eachscan line. The window memory pitch value is preferably a 12-bit datafield indicating the pitch of window memory addressing. Pitch refers tothe difference in memory address between two pixels that are verticallyadjacent within a window.

The window color value preferably is a 16-bit RGB color, which isapplied as a single color to the entire graphics window when the windowformat parameter is 1000b, 1001b, 1010b, or 1011b. Every pixel in thewindow preferably has the color specified by the window color value,while the alpha value is determined per pixel and per window asspecified in the window descriptor and the pixel format. The enginepreferably uses the window color value to implement a solid surface.

Word 2 in the window descriptor preferably includes an alpha type, awidow alpha value, a window y-end value and a window y-start value. Theword 2 preferably also includes two bits reserved for future definition,such as high definition television (HD) applications. The alpha type ispreferably a 2-bit data field that indicates the method of selecting analpha value for the graphics window. The alpha type of 00b indicatesthat the alpha value is to be selected from chroma keying. Chroma keyingdetermines whether each pixel is opaque or transparent based on thecolor of the pixel. Opaque pixels are preferably considered to have analpha value of 1.0, and transparent pixels have an alpha value of 0,both on a scale of 0 to 1. Chroma keying compares the color of eachpixel to a reference color or to a range of possible colors; if thepixel matches the reference color, or if its color falls within thespecified range of colors, then the pixel is determined to betransparent. Otherwise it is determined to be opaque.

The alpha type of 01b indicates that the alpha value should be derivedfrom the graphics CLUT, using the alpha value in each entry of the CLUT.The alpha type of 10b indicates that the alpha value is to be derivedfrom the luminance Y. The Y value that results from conversion of thepixel color to the YUV color space, if the pixel color is not already inthe YUV color, is used as the alpha value for the pixel. The alpha typeof 11b indicates that only a single alpha value is to be applied to theentire graphics window. The single alpha value is preferably included asthe window alpha value next.

The window alpha value preferably is an 8-bit alpha value applied to theentire graphics window. The effective alpha value for each pixel in thewindow is the product of the window alpha and the alpha value determinedfor each pixel. For example, if the window alpha value is 0.5 on a scaleof 0 to 1, coded as 0×80, then the effective alpha value of every pixelin the window is one-half of the value encoded in or for the pixelitself. If the window format parameter is 1000b, i.e., a single alphavalue is to be applied to the graphics window, then the per-pixel alphavalue is treated as if it is 1.0, and the effective alpha value is equalto the window alpha value.

The window y-end value preferably is a 10-bit data field that indicatesthe ending display line of the graphics window on the screen. Thegraphics window defined by the window descriptor ends at the displayline indicated by the window y-end value. The window y-start valuepreferably is a 10-bit data field that indicates a starting display lineof the graphics window on a screen. The graphics window defined by thewindow descriptor begins at the display line indicated in the windowy-start value. Thus, a display of a graphics window can start on anydisplay line on the screen based on the window y-start value.

Word 3 in the window descriptor preferably includes a window filterenable parameter, a blank start pixel value, a window x-size value and awindow x-start value. In addition, the word 3 includes two bits reservedfor future definition, such as HD applications. Five bits of the 32-bitword 3 are not used. The window filter enable parameter is a 1-bit fieldthat indicates whether low pass filtering is to be enabled during YUV4:4:4 to YUV 4:2:2 conversion.

The blank start pixel value preferably is a 4-bit parameter indicating anumber of blank pixels at the beginning of each display line. The blankstart pixel value preferably signifies the number of pixels of the firstword read from memory, at the beginning of the corresponding graphicswindow, to be discarded. This field indicates the number of pixels inthe first word of data read from memory that are not displayed. Forexample, if memory words are 32 bits wide and the pixels are 4 bitseach, there are 8 possible first pixels in the first word. Using thisfield, 0 to 7 pixels may be skipped, making the 1^(st) to the 8^(th)pixel in the word appear as the first pixel, respectively. The blankstart pixel value allows graphics windows to have any horizontalstarting position on the screen, and may be used during soft horizontalscrolling of a graphics window.

The window x-size value preferably is a 10-bit data field that indicatesthe size of a graphics window in the x direction, i.e., horizontaldirection. The window x-size value preferably indicates the number ofpixels of a graphics window in a display line.

The window x-start value preferably is a 10-bit data field thatindicates a starting pixel of the graphics window on a display line. Thegraphics window defined by the window descriptor preferably begins atthe pixel indicated by the window x-start value of each display line.With the window x-start value, any pixel of a given display line can bechosen to start painting the graphics window. Therefore, there is noneed to load pixels on the screen prior to the beginning of the graphicswindow display area with black.

III. Graphics Window Control Data Passing Mechanism

In one embodiment of the present invention, a FIFO in the graphicsdisplay path accepts raw graphics data as the raw graphics data is readfrom memory, at the full memory data rate using a clock of the memorycontroller. In this embodiment, the FIFO provides this data, initiallystored in an external memory, to subsequent blocks in the graphicspipeline.

In systems such as graphics display systems where multiple types of datamay be output from one module, such as a memory controller subsystem,and used in another subsystem, such as a graphics processing subsystem,it typically becomes progressively more difficult to support acombination of dynamically varying data types and data transfer ratesand FIFO buffers between the producing and consuming modules. Theconventional way to address such problems is to design a logic blockthat understands the varying parameters of the data types in the firstmodule and controls all of the relevant variables in the second module.This may be difficult due to variable delays between the two modules,due to the use of FIFOs between them and varying data rate, and due tothe complexity of supporting a large number of data types.

The system preferably processes graphics images for display byorganizing the graphics images into windows in which the graphics imagesappear on the screen, obtaining data that describes the windows, sortingthe data according to the depth of the window on the display,transferring graphics images from memory, and blending the graphicsimages using alpha values associated with the graphics images.

In the preferred embodiment, a packet of control information called aheader packet is passed from the window controller to the displayengine. All of the required control information from the windowcontroller preferably is conveyed to the display engine such that all ofthe relevant variables from the window controller are properlycontrolled in a timely fashion and such that the control is notdependent on variations in delays or data rates between the windowcontroller and the display engine.

A header packet preferably indicates the start of graphics data for onegraphics window. The graphics data for that graphics window continuesuntil it is completed without requiring a transfer of another headerpacket. A new header packet is preferably placed in the FIFO whenanother window is to start. The header packets may be transferredaccording to the order of the corresponding window descriptors in thewindow descriptor lists.

In a display engine that operates according to lists of windowdescriptors, windows may be specified to overlap one another. At thesame time, windows may start and end on any line, and there may be manywindows visible on any one line. There are a large number of possiblecombinations of window starting and ending locations along vertical andhorizontal axes and depth order locations. The system preferablyindicates the depth order of all windows in the window descriptor listand implements the depth ordering correctly while accounting for allwindows.

Each window descriptor preferably includes a parameter indicating thedepth location of the associated window. The range that is allowed forthis parameter can be defined to be almost any useful value. In thepreferred embodiment there are 16 possible depth values, ranging from 0to 15, with 0 being the back-most (deepest, or furthest from theviewer), and 15 being the top or front-most depth. The windowdescriptors are ordered in the window descriptor list in order of thefirst display scan line where the window appears. For example if windowA spans lines 10 to 20, window B spans lines 12 to 18, and window Cspans lines 5 to 20, the order of these descriptors in the list would be{C, A, B}.

In the hardware, which is a preferably a VLSI device, there ispreferably on-chip memory capable of storing a number of windowdescriptors. In the preferred implementation, this memory can store upto 8 window descriptors on-chip, however the size of this memory may bemade larger or smaller without loss of generality. Window descriptorsare read from main memory into the on-chip descriptor memory in orderfrom the start of the list, and stopping when the on-chip memory is fullor when the most recently read descriptor describes a window that is notyet visible, i.e., its starting line is on a line that has a highernumber than the line currently being constructed. Once a window has beendisplayed and is no longer visible, it may be cast out of the on-chipmemory and the next descriptor in the list may read from main memory. Atany given display line, the order of the window descriptors in theon-chip memory bears no particular relation to the depth order of thewindows on the screen.

The hardware that controls the compositing of windows builds up thedisplay in layers, starting from the back-most layer. In the preferredembodiment, the back most layer is layer 0. The hardware performs aquick search of the back-most window descriptor that has not yet beencomposited, regardless of its location in the on-chip descriptor memory.In the preferred embodiment, this search is performed as follows:

All 8 window descriptors are stored on chip in such a way that the depthorder numbers of all of them are available simultaneously. While thedepth numbers in the window descriptors are 4 bit numbers, representing0 to 15, the on-chip memory has storage for 5 bits for the depth number.Initially the 5 bit for each descriptor is set to 0. The depth ordervalues are compared in a hierarchy of pair-wise comparisons, and thelower of the two depth numbers in each comparison wins the comparison.That is, at the first stage of the test descriptor pairs {0, 1}, {2, 3},{4, 5}, and {6, 7} are compared, where {0-7} represent the eightdescriptors stored in the on-chip memory. This results in four depthnumbers with associated descriptor numbers. At the next stage twopair-wise comparisons compare {(0, 1), (2, 3)} and {(4, 5), (6, 7)}.

Each of these results in a depth number of the lower depth order numberand the associated descriptor number. At the third stage, one pair-wisecomparison finds the smallest depth number of all, and its associateddescriptor number. This number points the descriptor in the on-chipmemory with the lowest depth number, and therefore the greatest depth,and this descriptor is used first to render the associated window on thescreen. Once this window has been rendered onto the screen for thecurrent scan line, the fifth bit of the depth number in the on-chipmemory is set to 1, thereby ensuring that the depth value number isgreater than 15, and as a result this depth number will preferably neveragain be found to be the back-most window until all windows have beenrendered on this scan line, preventing rendering this window twice.

Once all the windows have been rendered for a given scan line, the fifthbits of all the on-chip depth numbers are again set to 0; descriptorsthat describe windows that are no longer visible on the screen are castout of the on-chip memory; new descriptors are read from memory asrequired (that is, if all windows in the on-chip memory are visible, thenext descriptor is read from memory, and this repeats until the mostrecently read descriptor is not yet visible on the screen), and theprocess of finding the back most descriptor and rendering windows ontothe screen repeats.

Referring to FIG. 7, window descriptors are preferably sorted by thewindow controller and used to transfer graphics data to the displayengine. Each of window descriptors, including the window descriptor 0through the window descriptor 7 300 a-h, preferably contains a windowlayer parameter. In addition, each window descriptor is preferablyassociated with a window line done flag indicating that the windowdescriptor has been processed on a current display line.

The window controller preferably performs window sorting at each displayline using the window layer parameters and the window line done flags.The window controller preferably places the graphics window thatcorresponds to the window descriptor with the smallest window layerparameter at the bottom, while placing the graphics window thatcorresponds to the window descriptor with the largest window layerparameter at the top.

The window controller preferably transfers the graphics data for thebottom-most graphics window to be processed first. The window parametersof the bottom-most window are composed into a header packet and writtento the graphics FIFO. The DMA engine preferably sends a request to thememory controller to read the corresponding graphics data for thiswindow and send the graphics data to the graphics FIFO. The graphicsFIFO is then read by the display engine to compose a display line, whichis then written to graphics line buffers.

The window line done flag is preferably set true whenever the windowsurface has been processed on the current display line. The window linedone flag and the window layer parameter may be concatenated togetherfor sorting. The window line done flag is added to the window layerparameter as the most significant bit during sorting such that {windowline done flag[4], window layer parameter[3:0]} is a five bit binarynumber, a window layer value, with window line done flag as the mostsignificant bit.

The window controller preferably selects a window descriptor with thesmallest window layer value to be processed. Since the window line doneflag is preferably the most significant bit of the window layer value,any window descriptor with this flag set, i.e., any window that has beenprocessed on the current display line, will have a higher window layervalue than any of the other window descriptors that have not yet beenprocessed on the current display line. When a particular windowdescriptor is processed, the window line done flag associated with thatparticular window descriptor is preferably set high, signifying that theparticular window descriptor has been processed for the current displayline.

A sorter 304 preferably sorts all eight window descriptors after anywindow descriptor is processed. The sorting may be implemented usingbinary tree sorting or any other suitable sorting algorithm. In binarytree sorting for eight window descriptors, the window layer value forfour pairs of window descriptors are compared at a first level usingfour comparators to choose the window descriptor that corresponds to alower window in each pair. In the second level, two comparators are usedto select the window descriptor that corresponds to the bottom mostgraphics window in each of two pairs. In the third and the last level,the bottom-most graphics windows from each of the two pairs are comparedagainst each other preferably using only one comparator to select thebottom window.

A multiplexer 302 preferably multiplexes parameters from the windowdescriptors. The output of the sorter, i.e., window selected to be thebottom most, is used to select the window parameters to be sent to adirect memory access (“DMA”) module 306 to be packaged in a headerpacket and sent to a graphics FIFO 308. The display engine preferablyreads the header packet in the graphics FIFO and processes the rawgraphics data based on information contained in the header packet.

The header packet preferably includes a first header word and a secondheader word. Corresponding graphics data is preferably transferred asgraphics data words. Each of the first header word, the second headerword and the graphics data words preferably includes 32 bits ofinformation plus a data type bit. The first header word preferablyincludes a 1-bit data type, a 4-bit graphics type, a 1-bit first windowparameter, a 1-bit top/bottom parameter, a 2-bit alpha type, an 8-bitwindow alpha value and a 16-bit window color value. Table 2 showscontents of the first header word.

TABLE 2 First Header Word Bit Position 32 31-28 27 26 25-24 23-16 15-0Data Data graphics First top/ alpha window window Con- type type Windowbottom type alpha color tent

The 1-bit data type preferably indicates whether a 33-bit word in theFIFO is a header word or a graphics data word. A data type of 1indicates that the associated 33-bit word is a header word while thedata type of 0 indicates that the associated 33-bit word is a graphicsdata word. The graphics type indicates the data format of the graphicsdata to be displayed in the graphics window similar to the window formatparameter in the word 0 of the window descriptor, which is described inTable 1 above. In the preferred embodiment, when the graphics type is1111, there is no window on the current display line, indicating thatthe current display line is empty.

The first window parameter of the first header word preferably indicateswhether the window associated with that first header word is a firstwindow on a new display line. The top/bottom parameter preferablyindicates whether the current display line indicated in the first headerword is at the top or the bottom edges of the window. The alpha typepreferably indicates a method of selecting an alpha value individuallyfor each pixel in the window similar to the alpha type in the word 2 ofthe window descriptor.

The window alpha value preferably is an alpha value to be applied to thewindow as a whole and is similar to the window alpha value in the word 2of the window descriptor. The window color value preferably is the colorof the window in 16-bit RGB format and is similar to the window colorvalue in the word 1 of the window descriptor.

The second header word preferably includes the 1-bit data type, a 4-bitblank pixel count, a 10-bit left edge value, a 1-bit filter enableparameter and a 10-bit window size value. Table 3 shows contents of thesecond header word in the preferred embodiment.

TABLE 3 Second Header Word Bit Position 32 31-28 25-16 10 9-0 Data dataBlank pixel Left edge filter window size Content type count enabler

Similar to the first header word, the second header word preferablystarts with the data type indicating whether the second header word is aheader word or a graphics data word. The blank pixel count preferablyindicates a number of blank pixels at a left edge of the window and issimilar to the blank start pixel value in the word 3 of the windowdescriptor. The left edge preferably indicates a starting location ofthe window on a scan line, and is similar to the window x-start value inthe word 3 of the window descriptor. The filter enable parameterpreferably enables a filter during a conversion of graphics data from aYUV 4:4:4 format to a YUV 4:2:2 format and is similar to the windowfilter enable parameter in word 3 of the window descriptor. Some YUV4:4:4 data may contain higher frequency content than others, which maybe filtered by enabling a low pass filter during a conversion to the YUV4:2:2 format. The window size value preferably indicates the actualhorizontal size of the window and is similar to the window x-size valuein word 3 of the window descriptor.

When the composition of the last window of the last display line iscompleted, an empty-line header is preferably placed into the FIFO sothat the display engine may release the display line for display.

Packetized data structures have been used primarily in the communicationworld where large amount of data needs to be transferred betweenhardware using a physical data link (e.g., wires). The idea is not knownto have been used in the graphics world where localized and small datacontrol structures need to be transferred between different designentities without requiring a large off-chip memory as a buffer. In oneembodiment of the present system, header packets are used, and ageneral-purpose FIFO is used for routing. Routing may be accomplished ina relatively simple manner in the preferred embodiment because the writeport of the FIFO is the only interface.

In the preferred embodiment, the graphics FIFO is a synchronous 32×33FIFO built with a static dual-port RAM with one read port and one writeport. The write port preferably is synchronous to a 81 MHz memory clockwhile the read port may be asynchronous (not synchronized) to the memoryclock. The read port is preferably synchronous to a graphics processingclock, which runs preferably at 81 MHz, but not necessarily synchronizedto the memory clock. Two graphics FIFO pointers are preferablygenerated, one for the read port and one for the write port. In thisembodiment, each graphics FIFO pointer is a 6-bit binary counter whichranges from 000000b to 111111b, i.e., from 0 to 63. The graphics FIFO isonly 32 words deep and requires only 5 bits to represent each 33-bitword in the graphics FIFO. An extra bit is preferably used todistinguish between FIFO full and FIFO empty states.

The graphics data words preferably include the 1-bit data type and32-bit graphics data bits. The data type is 0 for the graphics datawords. In order to adhere to a common design practice that generallylimits the size of a DMA burst into a FIFO to half the size of the FIFO,the number of graphics data words in one DMA burst preferably does notexceed 16.

In an alternate embodiment, a graphics display FIFO is not used. In thisembodiment, the graphics converter processes data from memory at therate that it is read from memory. The memory and conversion functionsare in a same clock domain. Other suitable FIFO designs may be used.

Referring to FIG. 8, a flow diagram illustrates a process for loadingand processing window descriptors. First the system is preferably resetin step 310. Then the system in step 312 preferably checks for avertical sync (“VSYNC”). When the VSYNC is received, the system in step314 preferably proceeds to load window descriptors into the windowcontroller from the external SDRAM or other suitable memory over the DMAchannel for window descriptors. The window controller may store up toeight window descriptors in one embodiment of the present invention.

The step in step 316 preferably sends a new line header indicating thestart of a new display line. The system in step 320 preferably sorts thewindow descriptors in accordance with the process described in referenceto FIG. 7. Although sorting is indicated as a step in this flow diagram,sorting actually may be a continuous process of selecting thebottom-most window, i.e., the window to be processed. The system in step322 preferably checks to determine if a starting display line of thewindow is greater than the line count of the current display line. Ifthe starting display line of the window is greater than the line count,i.e., if the current display line is above the starting display line ofthe bottom most window, the current display line is a blank line. Thus,the system in step 318 preferably increments the line count and sendsanother new line header in step 316. The process of sending a new lineheader and sorting window descriptor continues as long as the startingdisplay line of the bottom most (in layer order) window is below thecurrent display line.

The display engine and the associated graphics filter preferably operatein one of two modes, a field mode and a frame mode. In both modes, rawgraphics data associated with graphics windows is preferably stored inframe format, including lines from both interlaced fields in the case ofan interlaced display. In the field mode, the display engine preferablyskips every other display line during processing. In the field mode,therefore, the system in step 318 preferably increments the line countby two each time to skip every other line. In the frame mode, thedisplay engine processes every display line sequentially. In the framemode, therefore, the system in step 318 preferably increments the linecount by one each time.

When the system in step 322 determines that the starting display of thewindow is greater than the line count, the system in step 324 preferablydetermines from the header packet whether the window descriptor is fordisplaying a window or re-loading the CLUT. If the window headerindicates that the window descriptor is for re-loading CLUT, the systemin step 328 preferably sends the CLUT data to the CLUT and turns on theCLUT write strobe to load CLUT.

If the system in step 324 determines that the window descriptor is fordisplaying a window, the system in step 326 preferably sends a newwindow header to indicate that graphics data words for a new window onthe display line are going to be transferred into the graphics FIFO.Then, the system in step 330 preferably requests the DMA module to sendgraphics data to the graphics FIFO over the DMA channel for graphicsdata. In the event the FIFO does not have sufficient space to storegraphics data in a new data packet, the system preferably waits untilsuch space is made available.

When graphics data for a display line of a current window is transferredto the FIFO, the system in step 332 preferably determines whether thelast line of the current window has been transferred. If the last linehas been transferred, a window descriptor done flag associated with thecurrent window is preferably set. The window descriptor done flagindicates that the graphics data associated with the current windowdescriptor has been completely transferred. When the window descriptordone flag is set, i.e., when the current window descriptor is completelyprocessed, the system sets a window descriptor done flag in step 334.Then the system in step 336 preferably sets a new window descriptorupdate flag and increments a window descriptor update counter toindicate that a new window descriptor is to be copied from the externalmemory.

Regardless of whether the last line of the current window has beenprocessed, the system in step 338 preferably sets the window line doneflag for the current window descriptor to signify that processing ofthis window descriptor on the current display line has been completed.The system in step 340 preferably checks the window line done flagsassociated with all eight window descriptors to determine whether theyare all set, which would indicate that all the windows of the currentdisplay line have been processed. If not all window line done flags areset, the system preferably proceeds to step 320 to sort the windowdescriptors and repeat processing of the new bottom-most windowdescriptor.

If all eight window line done flags are determined to be set in step340, all window descriptors on the current display line have beenprocessed. In this case, the system in step 342 preferably checkswhether an all window descriptor done flag has been set to determinewhether all window descriptors have been processed completely. The allwindow descriptor done flag is set when processing of all windowdescriptors in the current frame or field have been processedcompletely. If the all window descriptor done flag is set, the systempreferably returns to step 310 to reset and awaits another VSYNC in step312. If not all window descriptors have been processed, the system instep 344 preferably determines if the new window descriptor update flaghas been set. In the preferred embodiment, this flag would have been setin step 334 if the current window descriptor has been completelyprocessed.

When the new window descriptor update flag is set, the system in step352 preferably sets up the DMA to transfer a new window descriptor fromthe external memory. Then the system in step 350 preferably clears thenew window descriptor update flag. After the system clears the newwindow descriptor update flag or when the new window descriptor updateflag is not set in the first place, the system in step 348 preferablyincrements a line counter to indicate that the window descriptors for anext display line should be processed. The system in step 346 preferablyclears all eight window line done flags to indicate that none of thewindow descriptors have been processed for the next display line. Thenthe system in step 316 preferably initiates processing of the newdisplay line by sending a new line header to the FIFO.

In the preferred embodiment, the graphics converter in the displayengine converts raw graphics data having various different formats intoa common format for subsequent compositing with video and for display.The graphics converter preferably includes a state machine that changesstate based on the content of the window data packet. Referring to FIG.9, the state machine in the graphics converter preferably controlsunpacking and processing of the header packets. A first header wordprocessing state 354 is preferably entered wherein a first windowparameter of the first header word is checked (step 356) to determine ifthe window data packet is for a first graphics window of a new line. Ifthe header packet is not for a first window of a new line, after thefirst header word is processed, the state preferably changes to a secondheader word processing state 362.

If the header packet is for a first graphics window of a new line, thestate machine preferably enters a clock switch state 358. In the clockswitch state, the clock for a graphics line buffer which is going tostore the new line switches from a display clock to a memory clock,e.g., from a 13.5 MHz clock to a 81 MHz clock. From the clock switchstate, a graphics type in the first header word is preferably checked(step 360) to determine if the header packet represents an empty line. Agraphics type of 1111b preferably refers to an empty line.

If the graphics type is 1111b, the state machine enters the first headerword processing state 354, in which the first header word of the nextheader packet is processed. If the graphics type is not 1111b, i.e. thedisplay line is not empty, the second header word is processed. Then thestate machine preferably enters a graphics content state 364 whereinwords from the FIFO are checked (step 366) one at a time to verify thatthey are data words. The state machine preferably remains in thegraphics content state as long as each word read is a data word. Whilein the graphics content state, if a word received is not a data word,i.e., it is a first or second header word, then the state machinepreferably enters a pipeline complete state 368 and then to the firstheader processing state 354 where reading and processing of the nextwindow data packet is commenced.

Referring to FIG. 10, the display engine 58 is preferably coupled tomemory over a memory interface 370 and a CLUT over a CLUT interface 372.The display engine preferably includes the graphics FIFO 132 whichreceives the header packets and the graphics data from the memorycontroller over the memory interface. The graphics FIFO preferablyprovides received raw graphics data to the graphics converter 134 whichconverts the raw graphics data into the common compositing format.During the conversion of graphics format, the RGB to YUV converter 136and data from the CLUT over the CLUT interface 372 are used to convertRGB formatted data and CLUT formatted data, respectively.

The graphics converter preferably processes all of the window layers ofeach scan line in half the time, or less, of an interlaced display line,due to the need to have lines from both fields available in the SRAM foruse by the graphics filter when frame mode filtering is enabled. Thegraphics converter operates at 81 MHz in one embodiment of the presentinvention, and the graphics converter is able to process up to eightwindows on each scan line and up to three full width windows.

For example, with a 13.5 MHz display clock, if the graphics converterprocesses 81 Mpixels per second, it can convert three windows, eachcovering the width of the display, in half of the active display time ofan interlaced scan line. In one embodiment of the present invention, thegraphics converter processes all the window layers of each scan line inhalf the time of an interlaced display line, due to the need to havelines from both fields available in the SRAM for use by the graphicsfilter. In practice, there may be some more time available since theactive display time leaves out the blanking time, while the graphicsconverter can operate continuously.

Graphics pixels are preferably read from the FIFO in raw graphicsformat, using one of the multiple formats allowed in the presentinvention and specified in the window descriptor. Each pixel may occupyas little as two bits or as much as 16 bits in the preferred embodiment.Each pixel is converted to a YUVa24 format (also referred to as aYUV4:4:2:2), such as two adjacent pixels sharing a UV pair and havingunique Y and alpha values, and each of the Y, U, V and alpha componentsoccupying eight bits. The conversion process is generally dependent onthe pixel format type and the alpha specification method, both of whichare indicated by the window descriptor for the currently active window.Preferably, the graphics converter uses the CLUT memory to convert CLUTformat pixels into RGB or YUV pixels.

Conversions of RGB pixels may require conversion to YUV, and therefore,the graphics converter preferably includes a color space converter. Thecolor space converter preferably is accurate for all coefficients. Ifthe converter is accurate to eight or nine bits it can be used toaccurately convert eight bit per component graphics, such as CLUTentries with this level of accuracy or RGB24 images.

The graphics converter preferably produces one converted pixel per clockcycle, even when there are multiple graphics pixels packed into one wordof data from the FIFO. Preferably the graphics processing clock, whichpreferably runs at 81 MHz, is used during the graphics conversion. Thegraphics converter preferably reads data from the FIFO whenever bothconditions are met, including that the converter is ready to receivemore data, and the FIFO has data ready. The graphics converterpreferably receives an input from a graphics blender, which is the nextblock in the pipeline, which indicates when the graphics blender isready to receive more converted graphics data. The graphics convertermay stall if the graphics blender is not ready, and as a result, thegraphics converter may not be ready to receive graphics data from theFIFO.

The graphics converter preferably converts the graphics data into aYUValpha (“YUVa”) format. This YUVa format includes YUV 4:2:2 valuesplus an 8-bit alpha value for every pixel, and as such it occupies 24bits per pixel; this format is alternately referred to as aYUV 4:4:2:2.The YUV444-to-YUV422 converter 138 converts graphics data with the aYUV4:4:4:4 format from the graphics converter into graphics data with theaYUV 4:4:2:2 format and provides the data to the graphics blender 140.The YUV444-to-YUV422 converter preferably has a capacity of performinglow pass filtering to filter out high frequency components when needed.The graphics converter also sends and receives clock synchronizationinformation to and from the graphics line buffers over a clock controlinterface 376.

When provided with the converted graphics data, the graphics blender 140preferably composites graphics windows into graphics line buffers over agraphics line buffer interface 374. The graphics windows are alphablended into blended graphics and preferably stored in graphics linebuffers.

IV. Color Look-Up Table Loading Mechanism

A color look-up table (“CLUT”) is preferably used to supply color andalpha values to the raw graphics data formatted to address informationcontents of the CLUT. For a window surface based display, there may bemultiple graphics windows on the same display screen with differentgraphics formats. For graphics windows using a color look-up table(CLUT) format, it may be necessary to load specific color look-up tableentries from external memory to on-chip memory before the graphicswindow is displayed.

The system preferably includes a display engine that processes graphicsimages formatted in a plurality of formats including a color look uptable (CLUT) format. The system provides a data structure that describesthe graphics in a window, provides a data structure that provides anindicator to load a CLUT, sorts the data structures into a listaccording to the location of the window on the display, and loadsconversion data into a CLUT for converting the CLUT-formatted data intoa different data format according to the sequence of data structures onthe list.

In the preferred embodiment, each window on the display screen isdescribed with a window descriptor. The same window descriptor is usedto control CLUT loading as the window descriptor used to displaygraphics on screen. The window descriptor preferably defines the memorystarting address of the graphics contents, the x position on the displayscreen, the width of the window, the starting vertical display line andend vertical display line, window layer, etc. The same window structureparameters and corresponding fields may be used to define the CLUTloading. For example, the graphics contents memory starting address maydefine CLUT memory starting address; the width of graphics windowparameter may define the number of CLUT entries to be loaded; thestarting vertical display line and ending vertical display lineparameters may be used to define when to load the CLUT; and the windowlayer parameter may be used to define the priority of CLUT loading ifseveral windows are displayed at the same time, i.e., on the samedisplay line.

In the preferred embodiment, only one CLUT is used. As such, thecontents of the CLUT are preferably updated to display graphics windowswith CLUT formatted data that is not supported by the current content ofthe CLUT. One of ordinary skill in the art would appreciate that it isstraightforward to use more than one CLUT and switch back and forthbetween them for different graphics windows.

In the preferred embodiment, the CLUT is closely associated with thegraphics converter. In one embodiment of the present invention, the CLUTconsists of one SRAM with 256 entries and 32 bits per entry. In otherembodiments, the number of entries and bits per entry may vary. Eachentry contains three color components; either RGB or YUV format, and analpha component. For every CLUT-format pixel converted, the pixel datamay be used as the address to the CLUT and the resulting value may beused by the converter to produce the YUVa (or alternatively RGBa) pixelvalue.

The CLUT may be re-loaded by retrieving new CLUT data via the directmemory access module when needed. It generally takes longer to re-loadthe CLUT than the time available in a horizontal blanking interval.Accordingly, in the preferred embodiment, a whole scan line time isallowed to re-load the CLUT. While the CLUT is being reloaded, graphicsimages in non-CLUT formats may be displayed. The CLUT reloading ispreferably initiated by a window descriptor that contains informationregarding CLUT reloading rather than a graphics window displayinformation.

Referring to FIG. 11, the graphics CLUT 146 preferably includes agraphics CLUT controller 400 and a static dual-port RAM (SRAM) 402. TheSRAM preferably has a size of 256×32 which corresponds to 256 entries inthe graphics CLUT. Each entry in the graphics CLUT preferably has 32bits composed of Y+U+V+alpha from the most significant bit to the leastsignificant bit. The size of each field, including Y, U, V, and alpha,is preferably eight bits.

The graphics CLUT preferably has a write port that is synchronized to a81 MHz memory clock and a read port that may be asynchronous to thememory clock. The read port is preferably synchronous to the graphicsprocessing clock, which runs preferably at 81 MHz, but not necessarilysynchronized to the memory clock. During a read operation, the staticdual-port RAM (“SRAM”) is preferably addressed by a read address whichis provided by graphics data in the CLUT images. During the readoperation, the graphics data is preferably output as read data 414 whena memory address in the CLUT containing that graphics data is addressedby a read address 412.

During write operations, the window controller preferably controls thewrite port with a CLUT memory request signal 404 and a CLUT memory writesignal 408. CLUT memory data 410 is also preferably provided to thegraphics CLUT via the direct memory access module from the externalmemory. The graphics CLUT controller preferably receives the CLUT memorydata and provides the received CLUT memory data to the SRAM for writing.

Referring to FIG. 12, an exemplary timing diagram shows differentsignals involved during a writing operation of the CLUT. The CLUT memoryrequest signal 418 is asserted when the CLUT is to be re-loaded. Arising edge of the CLUT memory request signal 418 is used to reset awrite pointer associated with the write port. Then the CLUT memory writesignal 420 is asserted to indicate the beginning of a CLUT re-loadingoperation. The CLUT memory data 422 is provided synchronously to the 81MHz memory clock 416 to be written to the SRAM. The write pointerassociated with the write port is updated each time the CLUT is loadedwith CLUT memory data.

In the preferred embodiment, the process of reloading a CLUT isassociated with the process of processing window descriptors illustratedin FIG. 8 since CLUT re-loading is initiated by a window descriptor. Asshown in steps 324 and 328 of FIG. 8, if the window descriptor isdetermined to be for reloading CLUT in step 324, the system in step 328sends the CLUT data to the CLUT. The window descriptor for the CLUTreloading may appear anywhere in the window descriptor list.Accordingly, the CLUT reloading may take place at any time whenever CLUTdata is to be updated.

Using the CLUT loading mechanism in one embodiment of the presentinvention, more than one window with different CLUT tables may bedisplayed on the same display line. In this embodiment, only the minimumrequired entries are preferably loaded into the CLUT, instead of loadingall the entries every time. The loading of only the minimum requiredentries may save memory bandwidth and enables more functionality. TheCLUT loading mechanism is preferably relatively flexible and easy tocontrol, making it suitable for various applications. The CLUT loadingmechanism of the present invention may also simplify hardware design, asthe same state machine for the window controller may be used for CLUTloading. The CLUT preferably also shares the same DMA logic andlayer/priority control logic as the window controller.

V. Graphics Line Buffer Control Scheme

In the preferred embodiment of the present invention, the systempreferably blends a plurality of graphics images using line buffers. Thesystem initializes a line buffer by loading the line buffer with datathat represents transparent black, obtains control of a line buffer fora compositing operation, composites graphics contents into the linebuffer by blending the graphics contents with the existing contents ofthe line buffer, and repeats the step of compositing graphics contentsinto the line buffer until all of the graphics surfaces for theparticular line have been composited.

The graphics line buffer temporarily stores composited graphics images(blended graphics). A graphics filter preferably uses blended graphicsin line buffers to perform vertical filtering and scaling operations togenerate output graphics images. In the preferred embodiment, thedisplay engine composites graphics images line by line using a clockrate that is faster than the pixel display rate, and graphics filtersrun at the pixel display rate. In other embodiments, multiple lines ofgraphics images may be composited in parallel. In still otherembodiments, the line buffers may not be needed. Where line buffers areused, the system may incorporate an innovative control scheme forproviding the line buffers containing blended graphics to the graphicsfilter and releasing the line buffers that are used up by the graphicsfilter.

The line buffers are preferably built with synchronous static dual-portrandom access memory (“SRAM”) and dynamically switch their clocksbetween a memory clock and a display clock. Each line buffer ispreferably loaded with graphics data using the memory clock and thecontents of the line buffer is preferably provided to the graphicsfilter synchronously to the display clock. In one embodiment of thepresent invention, the memory clock is an 81 MHz clock used by thegraphics converter to process graphics data while the display clock is a13.5 MHz clock used to display graphics and video signals on atelevision screen. Other embodiments may use other clock speeds.

Referring to FIG. 13, the graphics line buffer preferably includes agraphics line buffer controller 500 and line buffers 504. The graphicsline buffer controller 500 preferably receives memory clock buffercontrol signals 508 as well as display clock buffer control signals 510.The memory clock control signals and the display clock control signalsare used to synchronize the graphics line buffers to the memory clockand the display clock, respectively. The graphics line buffer controllerreceives a clock selection vector 514 from the display engine to controlwhich graphics line buffers are to operate in which clock domain. Thegraphics line buffer controller returns a clock enable vector to thedisplay engine to indicate clock synchronization settings in accordancewith the clock selection vector.

In the preferred embodiment, the line buffers 504 include seven linebuffers 506 a-g. The line buffers temporarily store lines of YUVa24graphics pixels that are used by a subsequent graphics filter. Thisallows for four line buffers to be used for filtering and scaling, twoare available for progressing by one or two lines at the end of everyline, and one for the current compositing operation. Each line buffermay store an entire display line. Therefore, in this embodiment, thetotal size of the line buffers is (720 pixels/display line)*(3bytes/pixel)*(7 lines)=15,120 bytes.

Each of the ports to the SRAM including line buffers is 24 bits wide toaccommodate graphics data in YUVa24 format in this embodiment of thepresent invention. The SRAM has one read port and one write port. Oneread port and one write port are used for the graphics blenderinterface, which performs a read-modify-write typically once per clockcycle. In another embodiment of the present invention, an SRAM with onlyone port is used. In yet another embodiment, the data stored in the linebuffers may be YUVa32 (4:4:4:4), RGBa32, or other formats. Those skilledin the art would appreciate that it is straightforward to vary thenumber of graphics line buffers, e.g., to use different number of tapsfor filter, the format of graphics data or the number of read and writeports for the SRAM.

The line buffers are preferably controlled by the graphics line buffercontroller over a line buffer control interface 502. Over thisinterface, the graphics line buffer controller transfers graphics datato be loaded to the line buffers. The graphics filter reads contents ofthe line buffers over a graphics line buffer interface 516 and clearsthe line buffers by loading them with transparent black pixels prior toreleasing them to be loaded with more graphics data for display.

Referring FIG. 14, a flow diagram of a process of using line buffers toprovide composited graphics data from a display engine to a graphicsfilter is illustrated. After the graphics display system is reset instep 520, the system in step 522 receives a vertical sync (VSYNC)indicating a field start. Initially, all line buffers preferably operatein the memory clock domain. Accordingly, the line buffers aresynchronized to the 81 MHz memory clock in one embodiment of the presentinvention. In other embodiments, the speed of the memory clock may bedifferent from 81 MHz, or the line buffers may not operate in the clockdomain of the main memory. The system in step 524 preferably resets allline buffers by loading them with transparent black pixels.

The system in step 526 preferably stores composited graphics data in theline buffers. Since all buffers are cleared at every field start by thedisplay engine to the equivalent of transparent black pixels, thegraphics data may be blended the same way for any graphics window,including the first graphics window to be blended. Regardless of howmany windows are composited into a line buffer, including zero windows,the result is preferably always the correct pixel data.

The system in step 528 preferably detects a horizontal sync (HSYNC)which signifies a new display line. At the start of each display line,the graphics blender preferably receives a line buffer release signalfrom the graphics filter when one or more line buffers are no longerneeded by the graphics filter. Since four line buffers are used with thefour-tap graphics filter at any given time, one to three line buffersare preferably made available for use by the graphics blender to beginconstructing new display lines in them. Once a line buffer releasesignal is recognized, an internal buffer usage register is updated andthen clock switching is performed to enable the display engine to workon the newly released one to three line buffers. In other embodiments,the number of line buffers may be more or less than seven, and more orless than three line buffers may be released at a time.

The system in step 534 preferably performs clock switching. Clockswitching is preferably done in the memory clock domain by the displayengine using a clock selection vector. Each bit of the clock selectionvector preferably corresponds to one of the graphics line buffers.Therefore, in one embodiment of the present invention with sevengraphics line buffers, there are seven bits in the clock selectionvector. For example, a corresponding bit of logic 1 in the clockselection vector indicates that the line buffer operates in the memoryclock domain while a corresponding bit of logic 0 indicates that theline buffer operates in the display clock domain.

Other embodiments may have different numbers of line buffers and thenumber of bits in the clock selection vector may vary accordingly. Clockswitching logic preferably switches between the memory clock and thedisplay clock in accordance with the clock selection vector. The clockselection vector is preferably also used to multiplex the memory clockbuffer control signals and the display clock buffer control signals.

Since there is preferably no active graphics data at field and linestarts, clock switching preferably is done at the field start and theline start to accommodate the graphics filter to access graphics data inreal-time. At the field and line starts, clock switching may be donewithout causing glitches on the display side. Clock switching typicallyrequires a dead cycle time. A clock enable vector indicates that thegraphics line buffers are ready to synchronize to the clocks again. Theclock enable vector is preferably the same size at the clock selectionvector. The clock enable vector is returned to the display engine to becompared with the clock selection vector.

During clock switching, the clock selection vector is sent by thedisplay engine to the graphics line buffer block. The clocks arepreferably disabled to ensure a glitch-free clock switching. Thegraphics line buffers send the clock enable vector to the display enginewith the clock synchronization settings requested in the clock selectionvector. The display engine compares contents of the clock selectionvector and the clock enable vector. When the contents match, the clocksynchronization is preferably turned on again.

After the completion of clock switching during the video inactiveregion, the system in step 536 preferably provides the graphics data inthe line buffers to the graphics filter for anti-flutter filtering,sample rate conversion (SRC) and display. At the end of the currentdisplay line, the system looks for a VSYNC in step 538. If the VSYNC isdetected, the current field has been completed, and therefore, thesystem in step 530 preferably switches clocks for all line buffers tothe memory clock and resets the line buffers in step 524 for display ofanother field. If the VSYNC is not detected in step 538, the currentdisplay line is not the last display line of the current field. Thesystem continues to step 528 to detect another HSYNC for processing anddisplaying of the next display line of the current field.

VI. Window Soft Horizontal Scrolling Mechanism

Sometimes it is desirable to scroll a graphics window softly, e.g.,display text that moves from left to right or from right to leftsmoothly on a television screen. There are some difficulties that may beencountered in conventional methods that seek to implement horizontalsoft scrolling.

Graphics memory buffers are conventionally implemented using low-costDRAM, SDRAM, for example. Such memory devices are typically slow and mayrequire each burst transfer to be within a page. Smooth (or soft)horizontal scrolling, however, preferably enables the starting addressto be set to any arbitrary pixel. This may conflict with the transfer ofdata in bursts within the well-defined pages of DRAM. In addition,complex control logic may be required to monitor if page boundaries areto be crossed during the transfer of pixel maps for each step duringsoft horizontal scrolling.

In the preferred embodiment, an implementation of a soft horizontalscrolling mechanism is achieved by incrementally modifying the contentof a window descriptor for a particular graphics window. The window softhorizontal scrolling mechanism preferably enables positioning thecontents of graphics windows on arbitrary positions on a display line.

In an embodiment of the present invention, the soft horizontal scrollingof graphics windows is implemented based on an architecture in whicheach graphics window is independently stored in a normal graphics buffermemory device (SDRAM, EDO-DRAM, DRAM) as a separate object. Windows arecomposed on top of each other in real time as required. To scroll awindow to the left or right, a special field is defined in the windowdescriptor that tells how many pixels are to be shifted to the left orright.

The system according to the present invention provides a method ofhorizontally scrolling a display window to the left, which includes thesteps of blanking out one or more pixels at a beginning of a portion ofgraphics data, the portion being aligned with a start address; anddisplaying the graphics data starting at the first non-blanked out pixelin the portion of the graphics data aligned with the start address.

The system according to the present invention also provides a method ofhorizontally scrolling a display window to the right which includes thesteps of moving a read pointer to a new start address that isimmediately prior to a current start address, blanking out one or morepixels at a beginning of a portion of graphics data, the portion beingaligned to the new start address, and displaying the graphics datastarting at the first non-blanked out pixel in the portion of thegraphics data aligned with the new start address.

In practice, each graphics window is preferably addressed using aninteger word address. For example, if the memory system uses 32 bitwords, then the address of the start of a window is defined to bealigned to a multiple of 32 bits, even if the first pixel that isdesired to be displayed is not so aligned. Each graphics window alsopreferably has associated with it a horizontal offset parameter, inunits of pixels, that indicates a number of pixels to be ignored,starting at the indicated starting address, before the active display ofthe window starts. In the preferred embodiment, the horizontal offsetparameter is the blank start pixel value in the word 3 of the windowdescriptor. For example, if the memory system uses 32-bit words and thegraphics format of a window uses 8 bits per pixel, each 32-bit wordcontains four pixels. In this case, the display of the window may ignoreone, two or three pixels (8, 16, or 24 bits), causing an effective leftshift of one, two, or three pixels.

In the embodiment illustrated by the above example, the memory systemuses 32-bit words. In other embodiments, the memory system may use moreor less number of bits per word, such as 16 bits per word or 64 bits perword. In addition, pixels in other embodiments may have variousdifferent number of bits per pixel, such as 1, 2, 4, 8, 16, 24 and 32.

Referring to FIG. 15, in the preferred embodiment, a first pixel (e.g.,the first 8 bits) 604 of a 32-bit word 600, which is aligned to thestart address, is blanked out. The remaining three 8-bit pixels, otherthan the blanked out first pixel, are effectively shifted to the left byone pixel. Prior to blanking out, a read pointer 602 points to the firstbit of the 32-bit word. After blanking out, the read pointer 602 pointsto the ninth bit of the 32-bit word.

Further, a shift of four pixels is implemented by changing the startaddress by one to the next 32-bit word. Shifts of any number of pixelsare thereby implemented by a combination of adjusting the starting wordaddress and adjusting the pixel shift amount. The same mechanism may beused for any number of bits per pixel (1, 2, 4, etc.) and any memoryword size.

To shift a pixel or pixels to the right, the shifting cannot be achievedsimply by blanking some of the bits at the start address since anyblanking at the start will simply have an effect of shifting pixels tothe left. Further, the shifting to the right cannot be achieved byblanking some of the bits at the end of the last data word of a displayline since display of a window starts at the start address regardless ofthe position of the last pixel to be displayed.

Therefore, in one embodiment of the present invention, when the graphicsdisplay is to be shifted to the right, a read pointer pointing at thestart address is preferably moved to an address that is just before thestart address, thereby making that address the new start address. Then,a portion of the data word aligned with the new start address is blankedout. This provides the effect of shifting the graphics display to theright.

For example, a memory system may use 32-bit words and the graphicsformat of a window may use 2 bits per pixel, e.g., a CLUT 2 format. Ifthe graphics display is to be shifted by a pixel to the right, the readpointer is moved to an address that is just before the start address,and that address becomes a new start address. Then, the first 30 bits ofthe 32-bit word that is aligned with the new start address are blankedout. In this case, blanking out of a portion of the 32-bit word that isaligned with the new start address has the effect of shifting thegraphics display to the right.

Referring to FIG. 16, a 32-bit word 610 that is aligned with thestarting address is shifted to the right by one pixel. The 32-bit word610 has a CLUT 2 format, and therefore contains 16 pixels. A readpointer 612 points at the beginning of the 32-bit word 610. To shift thepixels in the 32-bit word 610 to the right, an address that is justbefore the start address is made a new start address. A 32-bit data word618 is aligned with the new start address. Then, the first 30 bits (15pixels) 616 of the 32-bit data word 618 aligned with the new startaddress are blanked out. The read pointer 612 points at a new location,which is the 31^(st) bit of the new start address. The 31^(st) bit andthe 32^(nd) bit of the new start address may constitute a pixel 618.Insertion of the pixel 618 in front of 16 pixels of the 32-bit data word610 effectively shifts those 16 pixels to the right by one pixel.

VII. Anti-Aliased Text and Graphics

TV-based applications, such as interactive program guides, enhanced TV,TV navigators, and web browsing on TV frequently require the display oftext and line-oriented graphics on the display. A graphical element orglyph generally represents an image of text or graphics. Graphicalelement may refer to text glyphs or graphics. In conventional methods ofdisplaying text on TV or computer displays, graphical elements arerendered as arrays of pixels (picture elements) with two states forevery pixel, i.e. the foreground and background colors.

In some cases the background color is transparent, allowing video orother graphics to show through. Due to the relatively low resolution ofmost present day TVs, diagonal and round edges of graphical elementsgenerally show a stair-stepped appearance which may be undesirable; andfine details are constrained to appear as one or more complete pixels(dots), which may not correspond well to the desired appearance. Theinterlaced nature of TV displays causes horizontal edges of graphicalelements, or any portion of graphical elements with a significantvertical gradient, to show a “fluttering” appearance with conventionalmethods.

Some conventional methods blend the edges of graphical elements withbackground colors in a frame buffer, by first reading the color in theframe buffer at every pixel where the graphical element will be written,combining that value with the foreground color of the graphical element,and writing the result back to the frame buffer memory. This methodrequires there to be a frame buffer; it requires the frame buffer to usea color format that supports such blending operations, such as RGB24 orRGB16, and it does not generally support the combination of graphicalelements over full motion video, as such functionality may requirerepeating the read, combine and write back function of all pixels of allgraphical elements for every frame or field of the video in a timelymanner.

The system preferably displays a graphical element by filtering thegraphical element with a low pass filter to generate a multi-level valueper pixel at an intended final display resolution and uses themulti-level values as alpha blend values for the graphical element inthe subsequent compositing stage.

In one embodiment of the present invention, a method of displayinggraphical elements on televisions and other displays is used. A deepcolor frame buffer with, for example, 16, 24, or 32 bits per pixel, isnot required to implement this method since this method is effectivewith as few as two bits per pixel. Thus, this method may result in asignificant reduction in both the memory space and the memory bandwidthrequired to display text and graphics. The method preferably provideshigh quality when compared with conventional methods of anti-aliasedtext, and produces higher display quality than is available withconventional methods that do not support anti-aliased text.

Referring to FIG. 17, a flow diagram illustrates a process of providingvery high quality display of graphical elements in one embodiment of thepresent invention. First, the bi-level graphical elements are filteredby the system in step 652. The graphical elements are preferablyinitially rendered by the system in step 650 at a significantly higherresolution than the intended final display resolution, for example, fourtimes the final resolution in both horizontal and vertical axes. Thefilter may be any suitable low pass filter, such as a “box” filter. Theresult of the filtering operation is a multi-level value per pixel atthe intended display resolution.

The number of levels may be reduced to fit the number of bits used inthe succeeding steps. The system in step 654 determines whether thenumber of levels are to be reduced by reducing the number of bits used.If the system determines that the number of levels are to be reduced,the system in step 656 preferably reduces the number of bits. Forexample, the result of box-filtering 4×4 super-sampled graphicalelements normally results in 17 possible levels; these may be convertedthrough truncation or other means to 16 levels to match a 4 bitrepresentation, or eight levels to match a 3 bit representation, or fourlevels to match a 2 bit representation. The filter may provide arequired vertical axis low pass filter function to provide anti-flutterfilter effect for interlaced display.

In step 658, the system preferably uses the resulting multi-levelvalues, either with or without reduction in the number of bits, as alphablend values, which are preferably pixel alpha component values, for thegraphical elements in a subsequent compositing stage. The multi-levelgraphical element pixels are preferably written into a graphics displaybuffer where the values are used as alpha blend values when the displaybuffer is composited with other graphics and video images.

In an alternate embodiment, the display buffer is defined to have aconstant foreground color consistent with the desired foreground colorof the text or graphics, and the value of every pixel in the displaybuffer is defined to be the alpha blend value for that pixel. Forexample, an Alpha-4 format specifies four bits per pixel of alpha blendvalue in a graphics window, where the 4 bits define alpha blend valuesof 0/16, 1/16, 2/16, . . . , 13/16, 14/16, and 16/16. The value 15/16 isskipped in this example in order to obtain the endpoint values of 0 and16/16 (1) without requiring the use of an additional bit. In thisexample format, the display window has a constant foreground color whichis specified in the window descriptor.

In another alternate embodiment, the alpha blend value per pixel isspecified for every pixel in the graphical element by choosing a CLUTindex for every pixel, where the CLUT entry associated with every indexcontains the desired alpha blend value as part of the CLUT contents. Forexample, a graphical element with a constant foreground color and 4 bitsof alpha per pixel can be encoded in a CLUT 4 format such that everypixel of the display buffer is defined to be a 4 bit CLUT index, andeach of the associated 16 CLUT entries has the appropriate alpha blendvalue (0/16, 1/16, 2/16, . . . , 14/16, 16/16) as well as the (same)constant foreground color in the color portion of the CLUT entries.

In yet another alternate embodiment, the alpha per pixel values are usedto form the alpha portion of color + alpha pixels in the display buffer,such as alphaRGB(4,4,4,4) with 4 bits for each of alpha, Red, Green, andBlue, or alphaRGB32 with 8 bits for each component. This format does notrequire the use of a CLUT.

In still another alternate embodiment, the graphical element may or maynot have a constant foreground color. The various foreground colors areprocessed using a low-pass filter as described earlier, and the outlineof the entire graphical element (including all colors other than thebackground) is separately filtered also using a low pass filter asdescribed. The filtered foreground color is used as either the directcolor value in, e.g., an alphaRGB format (or other color space, such asalphaYUV) or as the color choice in a CLUT format, and the result offiltering the outline is used as the alpha per pixel value in either adirect color format such as alphaRGB or as the choice of alpha value perCLUT entry in a CLUT format.

The graphical elements are displayed on the TV screen by compositing thedisplay buffer containing the graphical elements with optionally othergraphics and video contents while blending the subject display bufferwith all layers behind it using the alpha per pixel values created inthe preceding steps. Additionally, the translucency or opacity of theentire graphical element may be varied by specifying the alpha value ofthe display buffer via such means as the window alpha value that may bespecified in a window descriptor.

VIII. Video Synchronization

When a composite video signal (analog video) is received into thesystem, it is preferably digitized and separated into YUV (luma andchroma) components for processing. Samples taken for YUV are preferablysynchronized to a display clock for compositing with graphics data atthe video compositor. Mixing or overlaying of graphics with decodedanalog video may require synchronizing the two image sources exactly.Undesirable artifacts such as jitter may be visible on the displayunless a synchronization mechanism is implemented to correctlysynchronize the samples from the analog video to the display clock. Inaddition, analog video often does not adhere strictly to the televisionstandards such as NTSC and PAL. For example, analog video whichoriginates in VCRs may have synchronization signals that are not alignedwith chroma reference signals and also may have inconsistent lineperiods. Thus, the synchronization mechanism preferably should correctlysynchronize samples from non-standard analog videos as well.

The system, therefore, preferably includes a video synchronizingmechanism that includes a first sample rate converter for converting asampling rate of a stream of video samples to a first converted rate, afilter for processing at least some of the video samples with the firstconverted rate, and a second sample rate converter for converting thefirst converted rate to a second converted rate.

Referring to FIG. 18, the video decoder 50 preferably samples andsynchronizes the analog video input. The video receiver preferablyreceives an analog video signal 706 into an analog-to-digital converter(ADC) 700 where the analog video is digitized. The digitized analogvideo 708 is preferably sub-sampled by a chroma-locked sample rateconverter (SRC) 708. A sampled video signal 710 is provided to anadaptive 2H comb filter/chroma demodulator/luma processor 702 to beseparated into YUV (luma and chroma) components. In the 2H combfilter/chroma demodulator/luma processor 702, the chroma components aredemodulated. In addition, the luma component is preferably processed bynoise reduction, coring and detail enhancement operations. The adaptive2H comb filter provides the sampled video 712, which has been separatedinto luma and chroma components and processed, to a line-locked SRC 704.The luma and chroma components of the sample video is preferablysub-sampled once again by the line-locked SRC and the sub-sampled video714 is provided to a time base corrector (TBC) 72. The time basecorrector preferably provides an output video signal 716 that issynchronized to a display clock of the graphics display system. In oneembodiment of the present invention, the display clock runs at a nominal13.5 MHz.

The synchronization mechanism preferably includes the chroma-locked SRC70, the line-locked SRC 704 and the TBC 72. The chroma-locked SRCoutputs samples that are locked to chroma subcarrier and its referencebursts while the line-locked SRC outputs samples that are locked tohorizontal syncs. In the preferred embodiment, samples of analog videoare over-sampled by the ADC 700 and then down-sampled by thechroma-locked SRC to four times the chroma sub-carrier frequency (Fsc).The down-sampled samples are down-sampled once again by the line-lockedSRC to line-locked samples with an effective sample rate of nominally13.5 MHz. The time base corrector is used to align these samples to thedisplay clock, which runs nominally at 13.5 MHz.

Analog composite video has a chroma signal frequency interleaved infrequency with the luma signal. In an NTSC standard video, this chromasignal is modulated on to the Fsc of approximately 3.579545 MHz, orexactly 227.5 times the horizontal line rate. The luma signal covers afrequency span of zero to approximately 4.2 MHz. One method forseparating the luma from the chroma is to sample the video at a ratethat is a multiple of the chroma sub-carrier frequency, and use a combfilter on the sampled data. This method generally imposes a limitationthat the sampling frequency is a multiple of the chroma-sub-carrierfrequency (Fsc).

Using such a chroma-locked sampling frequency generally imposessignificant costs and complications on the implementation, as it mayrequire the creation of a sample clock of the correct frequency, whichitself may require a stable, low noise controllable oscillator (e.g. aVCXO) in a control loop that locks the VCXO to the chroma burstfrequency. Different sample frequencies are typically required fordifferent video standards with different chroma subcarrier frequencies.Sampling at four times the subcarrier frequency, i.e. 14.318 MHz forNTSC standard and 17.72 MHz for PAL standard, generally requires moreanti-alias filtering before digitization than is required when samplingat higher frequencies such as 27 MHz. In addition, such a chroma-lockedclock frequency is often unrelated to the other frequencies in a largescale digital device, requiring multiple clock domains and asynchronousinternal interfaces.

In the preferred embodiment, however, the samples are not taken at afrequency that is a multiple of Fsc. Rather, in the preferredembodiment, an integrated circuit takes samples of the analog video at afrequency that is essentially arbitrary and that is greater than fourtimes the Fsc (4 Fsc=14.318 MHz). The sampling frequency preferably is27 MHz and preferably is not locked to the input video signal in phaseor frequency. The sampled video data then goes through the chroma-lockedSRC that down-samples the data to an effective sampling rate of 4 Fsc.This and all subsequent operations are preferably performed in digitalprocessing in a single integrated circuit.

The effective sample rate of 4 Fsc does not require a clock frequencythat is actually at 4 Fsc, rather the clock frequency can be almost anyhigher frequency, such as 27 MHz, and valid samples occur on some clockcycles while the overall rate of valid samples is equal to 4 Fsc. Thedown-sampling (decimation) rate of the SRC is preferably controlled by achroma phase and frequency tracking module. The chroma phase andfrequency tracking module looks at the output of the SRC during thecolor burst time interval and continuously adjusts the decimation ratein order to align the color burst phase and frequency. The chroma phaseand frequency tracking module is implemented as a logical equivalent ofa phase locked loop (PLL), where the chroma burst phase and frequencyare compared in a phase detector to the effective sample rate, which isintended to be 4 Fsc, and the phase and frequency error terms are usedto control the SRC decimation rate.

The decimation function is applied to the incoming sampled video, andtherefore the decimation function controls the chroma burst phase andfrequency that is applied to the phase detector. This system is a closedfeedback loop (control loop) that functions in much the same way as aconventional PLL, and its operating parameters are readily designed inthe same way as those of PLLs.

Referring to FIG. 19, the chroma-locked SRC 70 preferably includes asample rate converter (SRC) 730, a chroma tracker 732 and a low passfilter (LPF). The SRC 730 is preferably a polyphase filter havingtime-varying coefficients. The SRC is preferably implemented with 35phases and the conversion ratio of 35/66. The SRC 730 preferablyinterpolates by exactly 35 and decimates by (66+epsilon), i.e. thedecimation rate is preferably adjustable within a range determined bythe minimum and maximum values of epsilon, generally a small range.Epsilon is a first adjustment value, which is used to adjust thedecimation rate of a first sample rate converter, i.e., thechroma-locked sample rate converter.

Epsilon is preferably generated by the control loop comprising thechroma tracker 732 and the LPF 734, and it can be negative, positive orzero. When the output samples of the SRC 730 are exactly frequency andphase locked to the color sub-carrier then epsilon is zero. The chromatracker tracks phase and frequency of the chroma bursts and comparesthem against an expected pattern.

In one embodiment of the present invention, the conversion rate of thechroma-locked SRC is adjusted so that, in effect, the SRC samples thechroma burst at exactly four times per chroma sub-carrier cycle. The SRCtakes the samples at phases 0 degrees, 90 degrees, 180 degrees and 270degrees of the chroma sub-carrier cycle. This means that a sample istaken at every cycle of the color sub-carrier at a zero crossing, apositive peak, zero crossing and a negative peak, (0, +1, 0, −1). If thepattern obtained from the samples is different from (0, +1, 0, −1), thisdifference is detected and the conversion ratio needs to be adjustedinside the control loop.

When the output samples of the chroma-locked SRC are lower in frequencyor behind in phase, e.g., the pattern looks like (−1, 0, +1, 0), thenthe chroma tracker 732 will make epsilon negative. When epsilon isnegative, the sample rate conversion ratio is higher than the nominal35/66, and this has the effect of increasing the frequency or advancingthe phase of samples at the output of the chroma-locked SRC. When theoutput samples of the chroma-locked SRC are higher in frequency orleading in phase, e.g., the pattern looks like (+1, 0, −1, 0), then thechroma tracker 732 will make epsilon positive. When epsilon is positive,the sample rate conversion ratio is lower than the nominal 35/66, andthis has the effect of decreasing the frequency or retarding the phaseof samples out of the chroma-locked SRC. The chroma tracker provideserror signal 736 to the LPF 734 that filters the error signal to filterout high frequency components and provides the filtered error signal tothe SRC to complete the control loop.

The sampling clock may run at the system clock frequency or at the clockfrequency of the destination of the decoded digital video. If thesampling clock is running at the system clock, the cost of theintegrated circuit may be lower than one that has a system clock and asub-carrier locked video decoder clock. A one clock integrated circuitmay also cause less noise or interference to the analog-to-digitalconverter on the IC. The system is preferably all digital, and does notrequire an external crystal or a voltage controlled oscillator.

Referring to FIG. 20, an alternate embodiment of the chroma-locked SRC70 preferably varies the sampling rate while the conversion rate is heldconstant. A voltage controlled oscillator (e.g., VCXO) 760 varies thesampling rate by providing a sampling frequency signal 718 to the ADC700. The conversion rate in this embodiment is fixed at 35/66 in the SRC750 which is the ratio between four times the chroma sub-carrierfrequency and 27 MHz.

In this embodiment, the chroma burst signal at the output of thechroma-locked SRC is compared with the expected chroma burst signal in achroma tracker 752. The error signals 756 from the comparison betweenthe converted chroma burst and the expected chroma burst are passedthrough a low pass filter 754 and then filtered error signals 758 areprovided to the VCXO 760 to control the oscillation frequency of theVCXO. The oscillation frequency of the VCXO changes in response to thevoltage level of the provided error signals. Use of input voltage tocontrol the oscillation frequency of a VCXO is well known in the art.The system as described here is a form of a phase locked loop (PLL), thedesign and use of which is well known in the art.

After the completion of chroma-luma separation and other processing tothe chroma and luma components, the samples with the effective samplerate of 4 Fsc (i.e. 4 times the chroma subcarrier frequency) arepreferably decimated to samples with a sample rate of nominally 13.5 MHzthrough the use of a second sample rate converter. Since this samplerate is less than the electrical clock frequency of the digitalintegrated circuit in the preferred embodiment, only some clock cyclescarry valid data. In this embodiment, the sample rate is preferablyconverted to 13.5 MHz, and is locked to the horizontal line rate throughthe use of horizontal sync signals. Thus, the second sample rateconverter is a line-locked sample rate converter (SRC).

The line-locked sample rate converter converts the current line of videoto a constant (Pout) number of pixels. This constant number of pixelsPout is normally 858 for ITU-R BT.601 applications and 780 for NTSCsquare pixel applications. The current line of video may have a variablenumber of pixels (Pin). In order to do this conversion from achroma-locked sample rate, the following steps are performed. The numberof input samples Pin of the current line of video is accuratelymeasured. This line measurement is used to calculate the sample rateconversion ratio needed to convert the line to exactly Pout samples. Anadjustment value to the sample rate conversion ratio is passed to asample rate converter module in the line-locked SRC to implement thecalculated sample rate conversion ratio for the current line. The sampleconversion ratio is calculated only once for each line. Preferably, theline-locked SRC also scales YUV components to the proper amplitudesrequired by ITU-R BT.601.

The number of samples detected in a horizontal line may be more or lessif the input video is a non-standard video. For example, if the incomingvideo is from a VCR, and the sampling rate is four times the colorsub-carrier frequency (4 Fsc), then the number of samples taken betweentwo horizontal syncs may be more or less than 910, where 910 is thenumber of samples per line that is obtained when sampling NTSC standardvideo at a sampling frequency of 4 Fsc. For example, the horizontal linetime from a VCR may vary if the video tape has been stretched.

The horizontal line time may be accurately measured by detecting twosuccessive horizontal syncs. Each horizontal sync is preferably detectedat the leading edge of the horizontal sync. In other embodiments, thehorizontal syncs may be detected by other means. For example, the shapeof the entire horizontal sync may be looked at for detection. In thepreferred embodiment, the sample rate for each line of video has beenconverted to four times the color sub-carrier frequency (4 Fsc) by thechroma-locked sample rate converter. The measurement of the horizontalline time is preferably done at two levels of accuracy, an integer pixelaccuracy and a sub-sample accuracy.

The integer pixel accuracy is preferably done by counting the integernumber of pixels that occur between two successive sync edges. The syncedge is presumed to be detected when the data crosses some thresholdvalue. For example, in one embodiment of the present invention, theanalog-to-digital converter (ADC) is a 10-bit ADC, i.e., converts aninput analog signal into a digital signal with (2^10−1=1023) scalelevels. In this embodiment, the threshold value is chosen to representan appropriate slicing level for horizontal sync in the 10-bit numbersystem of the ADC; a typical value for this threshold is 128. Thenegative peak (or a sync tip) of the digitized video signal normallyoccurs during the sync pulses. The threshold level would normally be setsuch that it occurs at approximately the mid-point of the sync pulses.The threshold level may be automatically adapted by the video decoder,or it may be set explicitly via a register or other means.

The horizontal sync tracker preferably detects the horizontal sync edgeto a sub-sample accuracy of (1/16)th of a pixel in order to moreaccurately calculate the sample rate conversion. The incoming samplesgenerally do not include a sample taken exactly at the threshold valuefor detecting horizontal sync edges. The horizontal sync trackerpreferably detects two successive samples, one of which has a valuelower than the threshold value and the other of which has a value higherthan the threshold value.

After the integer pixel accuracy is determined (sync edge has beendetected) the sub-pixel calculation is preferably started. The sync edgeof a horizontal sync is generally not a vertical line, but has a slope.In order to remove noise, the video signal goes through a low passfilter. The low pass filter generally decreases sharpness of thetransition, i.e., the low pass filter may make the transition from a lowlevel to a high level last longer.

The horizontal sync tracker preferably uses a sub-sample interpolationtechnique to obtain an accurate measurement of sync edge location bydrawing a straight line between the two successive samples of thehorizontal sync signal just above and just below the presumed thresholdvalue to determine where the threshold value has been crossed.

Three values are preferably used to determine the sub-sample accuracy.The three values are the threshold level (T), the value of the samplethat crossed the threshold level (V2) and the value of the previoussample that did not cross the threshold level (V1). The sub-sample valueis the ratio of T−V1)/(V2−V1). In the present embodiment a division isnot performed. The difference (V2−V1) is divided by 16 to make avariable called DELTA. V1 is then incremented by DELTA until it exceedsthe threshold T. The number of times that DELTA is added to V1 in orderto make it exceed the threshold (T) is the sub-pixel accuracy in termsof 1/16^(th) of a pixel.

For example, if the threshold value T is presumed to be 146 scalelevels, and if the values V1 and V2 of the two successive samples are140 and 156, respectively, the DELTA is calculated to be 1, and thecrossing of the threshold value is determined through interpolation tobe six DELTAs away from the first of the two successive samples. Thus,if the sample with value 140 is the nth sample and the sample with thevalue 156 is the (n+1)th sample, the (n+(6/16))th sample would have hadthe threshold value. Since the horizontal sync preferably is presumed tobe detected at the threshold value of the sync edge, a fractionalsample, i.e., 6/16 sample, is added to the number of samples countedbetween two successive horizontal syncs.

In order to sample rate convert the current number of input pixels Pinto the desired output pixels Pout, the sample rate converter module hasa sample rate conversion ratio of Pin/Pout. The sample rate convertermodule in the preferred embodiment of the line-locked sample rateconverter is a polyphase filter with time-varying coefficients. There isa fixed number of phases (I) in the polyphase filter. In the preferredembodiment, the number of phases (I) is 33. The control for thepolyphase filter is the decimation rate (d_act) and a reset phasesignal. The line measurement Pin is sent to a module that converts it toa decimation rate d_act such that I/d_act (33/d_act) is equal toPin/Pout. The decimation rate d_act is calculated as follows:d_act=(I/Pout)*Pin.

If the input video line is the standardized length of time and the fourtimes the color sub-carrier is the standardized frequency then Pin willbe exactly 910 samples. This gives a sample rate conversion ratio of(858/910). In the present embodiment the number of phases (theinterpolation rate) is 33. Therefore the nominal decimation rate forNTSC is 35(=(33/858)*910). This decimation rate d_act may then be sentto the sample rate converter module. A reset phase signal is sent to thesample rate converter module after the sub-sample calculation has beendone and the sample rate converter module starts processing the currentvideo line. In the preferred embodiment, only the active portion ofvideo is processed and sent on to a time base corrector. This results ina savings of memory needed. Only 720 samples of active video areproduced as ITU-R BT.601 output sample rates. In other embodiments, theentire horizontal line may be processed and produced as output.

In the preferred embodiment, the calculation of the decimation rated_act is done somewhat differently from the equation d_act=(I/Pout)*Pin.The results are the same, but there are savings to hardware. The currentline length, Pin, will have a relatively small variance with respect tothe nominal line length. Pin is nominally 910. It typically varies byless than 62. For NTSC, this variation is less than 5 microseconds. Thefollowing calculation is done:d_act=(I/Pout)*(Pin−Pin_nominal))+d_act_nominal

This preferably results in a hardware savings for the same level ofaccuracy. The difference (Pin−Pin_nominal) may be represented by fewerbits than are required to represent Pin so a smaller multiplier can beused. For NTSC, d_act_nominal is 35 and Pin_nominal is 910. The value(I/Pout)*(Pin−Pin_nominal) may now be called a delta_dec (deltadecimation rate) or a second adjustment value.

Therefore, in order to maintain the output sample rate of 858 samplesper horizontal line, the conversion rate applied preferably is33/(35+delta_dec) where the samples are interpolated by 33 and decimatedby (35+delta_dec). A horizontal sync tracker preferably detectshorizontal syncs, accurately counts the number of samples between twosuccessive horizontal syncs and generates delta_dec.

If the number of samples between two successive horizontal syncs isgreater than 910, the horizontal sync tracker generates a positivedelta_dec to keep the output sample rate at 858 samples per horizontalline. On the other hand, if the number of samples between two successivehorizontal syncs is less than 910, the horizontal sync tracker generatesa negative delta_dec to keep the output sample rate at 858 samples perhorizontal line.

For PAL standard video, the horizontal sync tracker generates thedelta_dec to keep the output sample rate at 864 samples per horizontalline.

In summary, the position of each horizontal sync pulse is determined tosub-pixel accuracy by interpolating between two successive samples, oneof which being immediately below the threshold value and the other beingimmediately above the threshold value. The number of samples between thetwo successive horizontal sync pulses is preferably calculated tosub-sample accuracy by determining the positions of two successivehorizontal sync pulses, both to sub-pixel accuracy. When calculatingdelta_dec, the horizontal sync tracker preferably uses the differencebetween 910 and the number of samples between two successive horizontalsyncs to reduce the amount of hardware needed.

In an alternate embodiment, the decimation rate adjustment value,delta_dec, which is calculated for each line, preferably goes through alow pass filter before going to the sample rate converter module. One ofthe benefits of this method is filtering of variations in the linelengths of adjacent lines where the variations may be caused by noisethat affects the accuracy of the measurement of the sync pulsepositions.

In another alternative embodiment, the input sample clock is not freerunning, but is instead line-locked to the input analog video,preferably 27 MHz. The chroma-locked sample rate converter converts the27 MHz sampled data to a sample rate of four times the color sub-carrierfrequency. The analog video signal is demodulated to luma and chromacomponent video signals, preferably using a comb filter. The luma andchroma component video signals are then sent to the line-locked samplerate converter where they are preferably converted to a sample rate of13.5 MHz. In this embodiment the 13.5 MHz sample rate at the output maybe exactly one-half of the 27 MHz sample rate at the input. Theconversion ratio of the line-locked sample rate converter is preferablyexactly one-half of the inverse of the conversion ratio performed by thechroma-locked sample rate converter.

Referring to FIG. 21, the line-locked SRC 704 preferably includes an SRC770 which preferably is a polyphase filter with time varyingcoefficients. The number of phases is preferably fixed at 33 while thenominal decimation rate is 35. In other words, the conversion ratio usedis preferably 33/(35+delta_dec) where delta_dec may be positive ornegative. The delta_dec is a second adjustment value, which is used toadjust the decimation rate of the second sample rate converter.Preferably, the actual decimation rate and phase are automaticallyadjusted for each horizontal line so that the number of samples perhorizontal line is 858 (720 active Y samples and 360 active U and Vsamples) and the phase of the active video samples is aligned properlywith the horizontal sync signals.

In the preferred embodiment, the decimation (down-sampling) rate of theSRC is preferably controlled by a horizontal sync tracker 772.Preferably, the horizontal sync tracker adjusts the decimation rate onceper horizontal line in order to result in a correct number and phase ofsamples in the interval between horizontal syncs. The horizontal synctracker preferably provides the adjusted decimation rate to the SRC 770to adjust the conversion ratio. The decimation rate is preferablycalculated to achieve a sub-sample accuracy of 1/16. Preferably, theline-locked SRC 704 also includes a YUV scaler 780 to scale YUVcomponents to the proper amplitudes required by ITU-R BT.601.

The time base corrector (TBC) preferably synchronizes the samples havingthe line-locked sample rate of nominally 13.5 MHz to the display clockthat runs nominally at 13.5 MHz. Since the samples at the output of theTBC are synchronized to the display clock, passthrough video may beprovided to the video compositor without being captured first.

To produce samples at the sample rate of nominally 13.5 MHz, thecomposite video may be sampled in any conventional way with a clock ratethat is generally used in the art. Preferably, the composite video issampled initially at 27 MHz, down sampled to the sample rate of 14.318MHz by the chroma-locked SRC, and then down sampled to the sample rateof nominally 13.5 MHz by the line-locked SRC. During conversion of thesample rates, the video decoder uses for timing the 27 MHz clock thatwas used for input sampling. The 27 MHz clock, being free-running, isnot locked to the line rate nor to the chroma frequency of the incomingvideo.

In the preferred embodiment, the decoded video samples are stored in aFIFO the size of one display line of active video at 13.5 MHz, i.e., 720samples with 16 bits per sample or 1440 bytes. Thus, the maximum delayamount of this FIFO is one display line time with a normal, nominaldelay of one-half a display line time. In the preferred embodiment,video samples are outputted from the FIFO at the display clock rate thatis nominally 13.5 MHz. Except for vertical syncs of the input video, thedisplay clock rate is unrelated to the timing of the input video. Inalternate embodiments, larger or smaller FIFOs may be used.

Even though the effective sample rate and the display clock rate areboth nominally 13.5 MHz the rate of the sampled video entering the FIFOand the display rate are generally different. This discrepancy is due todifferences between the actual frequencies of the effective input samplerate and the display clock. For example, the effective input sample rateis nominally 13.5 MHz but it is locked to operate at 858 times the linerate of the video input, while the display clock operates nominally at13.5 MHz independently of the line rate of the video input.

Since the rates of data entering and leaving the FIFO are typicallydifferent, the FIFO will tend to either fill up or become empty,depending on relative rates of the entering and leaving data. In oneembodiment of the present invention, video is displayed with an initialdelay of one-half a horizontal line time at the start of every field.This allows the input and output rates to differ up to the point wherethe input and output horizontal phases may change by up to one-half ahorizontal line time without causing any glitches at the display.

The FIFO is preferably filled up to approximately one-half full duringthe first active video line of every field prior to taking any outputvideo. Thus, the start of each display field follows the start of everyinput video field by a fixed delay that is approximately equal toone-half the amount of time for filling the entire FIFO. As such, theinitial delay at the start of every field is one-half a horizontal linetime in this embodiment, but the initial delay may be different in otherembodiments.

Referring to FIG. 22, the time base corrector (TBC) 72 includes a TBCcontroller 164 and a FIFO 166. The FIFO 166 receives an input video 714at nominally 13.5 MHz locked to the horizontal line rate of the inputvideo and outputs a delayed input video as an output video 716 that islocked to the display clock that runs nominally at 13.5 MHz. The initialdelay between the input video and the delayed input video is half ahorizontal line period of active video, e.g., 53.5 μs per active videoin a horizontal line/2=26.75 μs for NTSC standard video.

The TBC controller 164 preferably generates a vertical sync (VSYNC) fordisplay that is delayed by one-half a horizontal line from an inputVSYNC. The TBC controller 164 preferably also generates timing signalssuch as NTSC or PAL standard timing signals. The timing signals arepreferably derived from the VSYNC generated by the TBC controller andpreferably include horizontal sync. The timing signals are not affectedby the input video, and the FIFO is read out synchronously to the timingsignals. Data is read out of the FIFO according to the timing at thedisplay side while the data is written into the FIFO according to theinput timing. A line reset resets the FIFO write pointer to signal a newline. A read pointer controlled by the display side is updated by thedisplay timing.

As long as the accumulated change in FIFO fullness, in either direction,is less than one-half a video line, the FIFO will generally neitherunderflow nor overflow during the video field. This ensures correctoperation when the display clock frequency is anywhere within a fairlybroad range centered on the nominal frequency. Since the process isrepeated every field, the FIFO fullness changes do not accumulate beyondone field time.

Referring to FIG. 23, a flow diagram of a process using the TBC 72 isillustrated. The process resets in step 782 at system start up. Thesystem preferably checks for vertical sync (VSYNC) of the input video instep 784. After receiving the input VSYNC, the system in step 786preferably starts counting the number of incoming video samples. Thesystem preferably loads the FIFO in step 788 continuously with theincoming video samples. While the FIFO is being loaded, the system instep 790 checks if enough samples have been received to fill the FIFO upto a half full state.

When enough samples have been received to fill the FIFO to the half fullstate, the system in step 792 preferably generates timing signalsincluding horizontal sync to synchronize the output of the TBC to thedisplay clock. The system in step 794 preferably outputs the content ofthe FIFO continuously in sync with the display clock. The system in step796 preferably checks for another input VSYNC. When another inputvertical sync is detected, the process starts counting the number ofinput video samples again and starts outputting output video sampleswhen enough input video samples have been received to make the FIFO halffull.

In other embodiments of the present invention, the FIFO size may besmaller or larger. The minimum size acceptable is determined by themaximum expected difference in the video source sample rate and thedisplay sample rate. Larger FIFOs allow for greater variations in samplerate timing, however at greater expense. For any chosen FIFO size, thelogic that generates the sync signal that initiates display video fieldsshould incur a delay from the input video timing of one-half the delayof the entire FIFO as described above. However, it is not required thatthe delay be one-half the delay of the entire FIFO.

IX. Video Scaler

In certain applications of graphics and video display hardware, it maybe necessary or desirable to scale the size of a motion video imageeither upwards or downwards. It may also be desirable to minimize memoryusage and memory bandwidth demands. Therefore it is desirable to scaledown before writing to memory, and to scale up after reading frommemory, rather than the other way around in either case. Conventionallythere is either be separate hardware to scale down before writing tomemory and to scale up after reading from memory, or else all scaling isdone in one location or the other, such as before writing to memory,even if the scaling direction is upwards.

In the preferred embodiment, a video scaler performs both scaling-up andscaling-down of either digital video or digitized analog video. Thevideo scaler is preferably configured such that it can be used foreither scaling down the size of video images prior to writing them tomemory or for scaling up the size of video images after reading themfrom memory. The size of the video images are preferably downscaledprior to being written to memory so that the memory usage and the memorybandwidth demands are minimized. For similar reasons, the size of thevideo images are preferably upscaled after reading them from memory.

In the former case, the video scaler is preferably in the signal pathbetween a video input and a write port of a memory controller. In thelatter case, the video scaler is preferably in the signal path between aread port of the memory controller and a video compositor. Therefore,the video scaler may be seen to exist in two distinct logical places inthe design, while in fact occupying only one physical implementation.

This function is preferably achieved by arranging a multiplexingfunction at the input of the scaling engine, with one input to themultiplexer being connected to the video input port and the otherconnected to the memory read port. The memory write port is arrangedwith a multiplexer at its input, with one input to the multiplexerconnected to the output of the scaling engine and the other connected tothe video input port. The display output port is arranged with amultiplexer at its input, with one connected to the output of thescaling engine and the other input connected to the output of the memoryread port.

In the preferred embodiment, there are different clock domainsassociated with the video input and the display output functions of thechip. The video scaling engine uses a clock that is selected between thevideo input clock and the display output clock (display clock). Theclock selection uses a glitch-free clock selection logic, i.e. a circuitthat prevents the creation of extremely narrow clock pulses when theclock selection is changed. The read and write interfaces to memory bothuse asynchronous interfaces using FIFOs, so the memory clock domain maybe distinct from both the video input clock domain and the displayoutput clock domain.

Referring to FIG. 24, a flow diagram illustrates a process ofalternatively upscaling or downscaling the video input 800. The systemin step 802 preferably selects between a downscaling operation and anupscaling operation. If the downscaling operation is selected, thesystem in step 804 preferably downscales the input video prior tocapturing the input video in memory in step 806. If the upscalingoperation is selected in step 802, the system in step 806 preferablycaptures the input video in memory without scaling it.

Then the system in step 808 outputs the downscaled video as downscaledoutput 810. The system in step 808, however, sends non-scaled video inthe upscale path to be upscaled in step 812. The system in step 812upscales the non-scaled video and outputs it as upscaled video output814.

The video pipeline preferably supports up to one scaled video window andone passthrough video window, plus one background color, all of whichare logically behind the set of graphics windows. The order of thesewindows, from back to front, is fixed as background, then passthrough,then scaled video. The video windows are preferably always in YUVformat, although they can be in either 4:2:2 or 4:2:0 variants of YUV.Alternatively they can be in RGB or other formats.

When digital video, e.g., MPEG is provided to the graphics displaysystem or when analog video is digitized, the digital video or thedigitized analog video is provided to a video compositor using one ofthree signal paths, depending on processing requirements. The digitalvideo and the digitized analog video are provided to the videocompositor as passthrough video over a passthrough path, as upscaledvideo over an upscale path and a downscaled video over a downscale path.

Either of the digital video or the analog video may be provided to thevideo compositor as the passthrough video while the other of the digitalvideo or the analog video is provided as an upscaled video or adownscaled video. For example, the digital video may be provided to thevideo compositor over the passthrough path while, at the same time, thedigitized analog video is downscaled and provided to the videocompositor over the downscale path as a video window. In one embodimentof the present invention where the scaler engine is shared between theupscale path and the downscale path, the scaler engine may upscale videoin either the vertical or horizontal axis while downscaling video in theother axis. However, in this embodiment, an upscale operation and adownscale operation on the same axis are not performed at the same timesince only one filter is used to perform both upscaling and downscalingfor each axis.

Referring to FIG. 24 a single video scaler 52 preferably performs boththe downscaling and upscaling operations. In particular, signals of thedownscale path only are illustrated. The video scaler 52 includes ascaler engine 182, a set of line buffers 178, a vertical coefficientmemory 180A and a horizontal coefficient memory 180B. The scaler engine182 is implemented as a set of two polyphase filters, one for each ofhorizontal and vertical dimensions.

In one embodiment of the present invention, the vertical polyphasefilter is a four-tap filter with programmable coefficients from thevertical coefficient memory 180A. In other embodiments, the number oftaps in the vertical polyphase filter may vary. In one embodiment of thepresent invention, the horizontal polyphase filter is an eight-tapfilter with programmable coefficients from the horizontal coefficientmemory 180B. In other embodiments, the number of taps in the horizontalpolyphase filter may vary.

The vertical and the horizontal coefficient memories may be implementedin SRAM or any other suitable memory. Depending on the operation to beperformed, e.g. a vertical or horizontal axis, and scaling-up orscaling-down, appropriate filter coefficients are used, respectively,from the vertical and horizontal coefficient memories. Selection offilter coefficients for scaling-up and scaling-down operations are wellknown in the art.

The set of line buffers 178 are used to provide input of video data tothe horizontal and vertical polyphase filters. In this embodiment, threeline buffers are used, but the number of the line buffers may vary inother embodiments. In this embodiment, each of the three line buffers isused to provide an input to one of the taps of the vertical polyphasefilter with four taps. The input video is provided to the fourth tap ofthe vertical polyphase filter. A shift register having eight cells inseries is used to provide inputs to the eight taps of the horizontalpolyphase filter, each cell providing an input to one of the eight taps.

In this embodiment, a digital video signal 820 and a digitized analogsignal video 822 are provided to a first multiplexer 168 as first andsecond inputs. The first multiplexer 168 has two outputs. A first outputof the first multiplexer is provided to the video compositor as a passthrough video 186. A second output of the first multiplexer is providedto a first input of a second multiplexer 176 in the downscale path.

In the downscale path, the second multiplexer 176 provides either thedigital video or the digitized analog video at the second multiplexer'sfirst input to the video scaler 52. The video scaler provides adownscaled video signal to a second input of a third multiplexer 162.The third multiplexer provides the downscaled video to a capture FIFO158 which stores the captured downscaled video. The memory controller126 takes the captured downscaled video and stores it as a captureddownscaled video image into a video FIFO 148. An output of the videoFIFO is coupled to a first input of a fourth multiplexer 188. The fourthmultiplexer provides the output of the video FIFO, which is the captureddownscaled video image, as an output 824 to the graphics compositor, andthis completes the downscale path. Thus, in the downscale path, eitherthe digital video or the digitized analog video is downscaled first, andthen captured.

FIG. 26 is similar to FIG. 25, but in FIG. 26, signals of the upscalepath are illustrated. In the upscale path, the third multiplexer 162provides either the digital video 820 or the digitized analog video 822to the capture FIFO 158 which captures and stores input as a capturedvideo image. This captured video image is provided to the memorycontroller 126 which takes it and provides to the video FIFO 148 whichstores the captured video image.

An output of the video FIFO 148 is provided to a second input of thesecond multiplexer 176. The second multiplexer provides the capturedvideo image to the video scaler 52. The video scaler scales up thecaptured video image and provides it to a second input of the fourthmultiplexer 188 as an upscaled captured video image. The fourthmultiplexer provides the upscaled captured video image as the output 824to the video compositor. Thus, in the upscale path, either the digitalvideo or the digitized analog video is captured first, and thenupscaled.

Referring to FIG. 27, FIG. 27 is similar to FIG. 25 and FIG. 26, but inFIG. 27, signals of both the upscale path and the downscale path areillustrated.

X. Blending of Graphics and Video Surfaces

The graphics display system of the present invention is capable ofprocessing an analog video signal, a digital video signal and graphicsdata simultaneously. In the graphics display system, the analog anddigital video signals are processed in the video display pipeline whilethe graphics data is processed in the graphics display pipeline. Afterthe processing of the video signals and the graphics data have beencompleted, they are blended together at a video compositor. The videocompositor receives video and graphics data from the video displaypipeline and the graphics display pipeline, respectively, and outputs tothe video encoder (“VEC”).

The system may employ a method of compositing a plurality of graphicsimages and video, which includes blending the plurality of graphicsimages into a blended graphics image, combining a plurality of alphavalues into a plurality of composite alpha values, and blending theblended graphics image and the video using the plurality of compositealpha values.

Referring to FIG. 28, a flow diagram of a process of blending video andgraphics surfaces is illustrated. The graphics display system resets instep 902. In step 904, the video compositor blends the passthrough videoand the background color with the scaled video window, using the alphavalue which is associated with the scaled video window. The result ofthis blending operation is then blended with the output of the graphicsdisplay pipeline. The graphics output has been pre-blended in thegraphics blender in step 904 and filtered in step 906, and blendedgraphics contain the correct alpha value for multiplication by the videooutput. The output of the video blend function is multiplied by thevideo alpha which is obtained from the graphics pipeline and theresulting video and graphics pixel data stream are added together toproduce the final blended result.

In general, during blending of different layers of graphics and/orvideo, every layer {L1, L2, L3 . . . Ln}, where L1 is the back-mostlayer, each layer is blended with the composition of all of the layersbehind it, beginning with L2 being blended on top of L1. Theintermediate result R(i) from the blending of pixels P(i) of layer L(i)over the pixels P(i−1) of layer L(i−1) using alpha value A(i) is:R(i)=A(i)* P(i)+(1−A(i))*P(i−1).

The alpha values {A(i)} are in general different for every layer and forevery pixel of every layer. However, in some important applications, itis not practical to apply this formula directly, since some layers mayneed to be processed in spatial dimensions (e.g. 2 dimensional filteringor scaling) before they can be blended with the layer or layers behindthem. While it is generally possible to blend the layers first and thenperform the spatial processing, that would result in processing thelayers that should not be processed if these layers are behind thesubject layer that is to be processed. Processing of the layers that arenot to be processed may be undesirable.

Processing the subject layer first would generally require a substantialamount of local storage of the pixels in the subject layer, which may beprohibitively expensive. This problem is significantly exacerbated whenthere are multiple layers to be processed in front of one or more layersthat are not to be processed. In order to implement the formula abovedirectly, each of the layers would have to be processed first, i.e.using their own local storage and individual processing, before theycould be blended with the layer behind.

In the preferred embodiment, rather than blending all the layers fromback to front, all of the layers that are to be processed (e.g.filtered) are layered together first, even if there is one or morelayers behind them over which they should be blended, and the combinedupper layers are then blended with the other layers that are not to beprocessed. For example, layers {1, 2 and 3} may be layers that are notto be processed, while layers {4, 5, 6, 7, and 8} may be layers that areto undergo processing, while all 8 layers are to be blended together,using {A(i)} values that are independent for every layer and pixel. Thelayers that are to be filtered, upper layers, may be the graphicswindows. The lower layers may include the video window and passthroughvideo.

In the preferred embodiment, all of the layers that are to be filtered(referred to as “upper” layers) are blended together from back to frontusing a partial blending operation. In an alternate embodiment, two ormore of the upper layers may be blended together in parallel. Theback-most of the upper layers is not in general the back-most layer ofthe entire operation.

In the preferred embodiment, at each stage of the blending, anintermediate alpha value is maintained for later use for blending withthe layers that are not to be filtered (referred to as the “lower”layers).

The formula that represents the preferred blending scheme is:R(i)=A(i)*P(i)+(1−A(i))*P(i−1)andAR(i)=AR(i−1)*(1−A(i))where R(i) represents the color value of the resulting blended pixel,P(i) represents the color value of the current pixel, A(i) representsthe alpha value of the current pixel, P(i−1) represents the value at thelocation of the current pixel of the composition of all of the upperlayers behind the current pixel, initially this represents black beforeany layers are blended, AR(i) is the alpha value resulting from eachinstance of this operation, and AR(i−1) represents the intermediatealpha value at the location of the current pixel determined from all ofthe upper layers behind the current pixel, initially this representstransparency before any layers are blended. AR represents the alphavalue that will subsequently be multiplied by the lower layers asindicated below, and so an AR value of 1 (assuming alpha ranges from 0to 1) indicates that the current pixel is transparent and the lowerlayers will be fully visible when multiplied by 1.

In other words, in the preferred embodiment, at each stage of blendingthe upper layers, the pixels of the current layer are blended using thecurrent alpha value, and also an intermediate alpha value is calculatedas the product (1−A(i)) *(AR(i−1)). The key differences between this andthe direct evaluation of the conventional formula are: (1) thecalculation of the product of the set of {(1−A(i))} for the upperlayers, and (2) a virtual transparent black layer is used to initializethe process for blending the upper layers, since the lower layers thatwould normally be blended with the upper layers are not used at thispoint in this process.

The calculation of the product of the sets of {(1−A(i)} for the upperlayers is implemented, in the preferred embodiment, by repeatedlycalculating AR(i)=AR(i−1)*(1−A(i)) at each layer, such that when alllayers {i} have been processed, the result is that AR=the product of all(1−A(i)) values for all upper layers. Alternatively in otherembodiments, the composite alpha value for each pixel of blendedgraphics may be calculated directly as the product of all (1-alpha valueof the corresponding pixel of the graphics image on each layer)'swithout generating an intermediate alpha at each stage.

To complete the blending process of the entire series of layers,including the upper and lower layers, once the upper layers have beenblended together as described above, they may be processed as desiredand then the result of this processing, a composite intermediate image,is blended with the lower layer or layers. In addition, the resultingalpha values preferably are also processed in essentially the same wayas the image components. The lower layers can be blended in theconventional fashion, so at some point there can be a single imagerepresenting the lower layers. Therefore two images, one representingthe upper layers and one representing the lower layers can be blendedtogether. In this operation, the AR(n) value at each pixel that resultsfrom the blending of the upper layers and any subsequent processing isused to be multiplied with the composite lower layer.

Mathematically this latter operation is as follows: let L(u) be thecomposite upper layer resulting from the process described above andafter any processing, let AR(u) be the composite alpha value of theupper layers resulting from the process above and after any processing,let L(1) be the composite lower layer that results from blending alllower layers in the conventional fashion and after any processing, andlet Result be the final result of blending all the upper and lowerlayers, after any processing. Then, Result=L(u)+AR(u)*L(1). L(u) doesnot need to be multiplied by any additional alpha values, since all suchmultiplication operations were already performed at an earlier stage.

In the preferred embodiment, a series of images makes up the upperlayers. These are created by reading pixels from memory, as in aconventional graphics display device. Each pixel is converted into acommon format if it is not already in that format; in this example theYUV format is used. Each pixel also has an alpha value associated withit. The alpha values can come from a variety of sources, including (1)being part of the pixel value read from memory (2) an element in a colorlook-up table (CLUT) in cases where the pixel format uses a CLUT (3)calculated from the pixel color value, e.g. alpha as a function of Y,(4) calculated using a keying function, i.e. some pixel values aretransparent (i.e. alpha=0) and others are opaque (alpha=1) based on acomparison of the pixel value with a set of reference values, (5) analpha value may be associated with a region of the image as describedexternally, such as a rectangular region, described by the four cornersof the rectangle, may have a single alpha value associated with it, or(6) some combination of these.

The upper layers are preferably composited in memory storage bufferscalled line buffers. Each line buffer preferably is sized to containpixels of one scan line. Each line buffer has an element for each pixelon a line, and each pixel in the line buffer has elements for the colorcomponents, in this case Y, U and V, and one for the intermediate alphavalue AR. Before compositing of each line begins, the appropriate linebuffer is initialized to represent a transparent black having alreadybeen composited into the buffer; that is, the YUV value is set to thevalue that represents black (i.e. Y=0, U=V=128) and the alpha value ARis set to represent (1−transparent)=(1−0)=1.

Each pixel of the current layer on the current line is combined with thevalue pre-existing in the line buffer using the formulas alreadydescribed, i.e.,R(i)=A(i)*P(i)+(1−A(i))*P(i−1)andAR(i)=AR(i−1)*(1−A(i)).In other words, the color value of the current pixel P(i) is multipliedby its alpha value A(i), and the pixel in the line buffer representingthe same location on the line P(i−1) is read from the line buffer,multiplied by (1−A(i)), and added to the previous result, producing theresulting pixel value R(i). Also, the alpha value at the same locationin the line buffer (AR(i−1)) is read from the buffer and multiplied by(1−A(i)), producing AR(i). The results R(i) and AR(i) are then writtenback to the line buffer in the same location.

When multiplying a YUV value by an alpha value between 0 and 1, theoffset nature of the U and V values should preferably be accounted for.In other words, U=V=128 represents a lack of color and it is the valuethat should result from a YUV color value being multiplied by 0. Thiscan be done in at least two ways. In one embodiment of the presentinvention, 128 is subtracted from the U and V values before multiplyingby alpha, and then 128 is added to the result. In another embodiment, Uand V values are directly multiplied by alpha, and it is ensured that atthe end of the entire compositing process all of the coefficientsmultiplied by U and V sum to 1, so that the offset 128 value is notdistorted significantly.

Each of the layers in the group of upper layers is preferably compositedinto a line buffer starting with the back-most of the upper layers andprogressing towards the front until the front-most of the upper layershas been composited into the line buffer. In this way, a single hardwareblock, i.e., the display engine, may be used to implement the formulaabove for all of the upper layers. In this arrangement, the graphicscompositor engine preferably operates at a clock frequency that issubstantially higher than the pixel display rate. In one embodiment ofthe present invention, the graphics compositor engine operates at 81 MHzwhile the pixel display rate is 13.5 MHz.

This process repeats for all of the lines in the entire image, startingat the top scan line and progressing to the bottom. Once the compositingof each scan line into a line buffer has been completed, the scan linebecomes available for use in processing such as filtering or scaling.Such processing may be performed while subsequent scan lines are beingcomposited into other line buffers. Various processing operations may beselected such as anti-flutter filtering and vertical scaling.

In alternative embodiments more than one graphics layer may becomposited simultaneously, and in some such embodiments it is notnecessary to use line buffers as part of the compositing process. If allupper layers are composited simultaneously, the combination of all upperlayers can be available immediately without the use of intermediatestorage.

Referring to FIG. 29, a flow diagram of a process of blending graphicswindows is illustrated. The system preferably resets in step 920. Instep 922, the system preferably checks for a vertical sync (VSYNC). If aVSYNC has been received, the system in step 924 preferably loads a linefrom the bottom most graphics window into a graphics line buffer. Thenthe system in step 926 preferably blends a line from the next graphicswindow into the line buffer. Then the system in step 928 preferablydetermines if the last graphics window visible on a current display linehas been blended. If the last graphics window has not been blended, thesystem continues on with the blending process in step 926.

If the last window of the current display line has been reached, thesystem preferably checks in step 930 to determine if the last graphicsline of a current display field has been blended. If the last graphicsline has been blended, the system awaits another VSYNC in step 922. Ifthe last graphics line has not been blended, the system goes to the nextdisplay line in step 932 and repeats the blending process.

Referring to FIG. 30, a flow diagram of a process of receiving blendedgraphics 950, a video window 952 and a passthrough video 954 andblending them. A background color preferably is also blended in oneembodiment of the present invention. As step 956 indicates, the videocompositor preferably displays each pixel as they are composited withoutsaving pixels to a frame buffer or other memory.

When the video signals and graphics data are blended in the videocompositor, the system in step 958 preferably displays the passthroughvideo 954 outside the active window area first. There are 525 scan linesin each frame and 858 pixels in each scan line of NTSC standardtelevision signals, when a sample rate of 13.5 MHz is used, per ITU-RBt.601. An active window area of the NTSC standard television is insidean NTSC frame. There are 625 scan lines per frame and 864 pixels in eachscan line of PAL standard television, when using the ITU-R Bt.601standard sample rate of 13.5 MHz. An active window area of the PALstandard television is inside a PAL frame.

Within the active window area, the system in step 960 preferably blendsthe background color first. On top of the background color, the systemin step 962 preferably blends the portion of the passthrough video thatfalls within the active window area. On top of the passthrough window,the system in step 964 preferably blends the video window. Finally, thesystem in step 968 blends the graphics window on top of the compositedvideo window and outputs composited video 970 for display.

Interlaced displays, such as televisions, have an inherent tendency todisplay an apparent vertical motion at the horizontal edges of displayedobjects, with horizontal lines, and on other points on the display wherethere is a sharp contrast gradient along the vertical axis. Thisapparent vertical motion is variously referred to as flutter, flicker,or judder.

While some image elements can be designed specifically for display oninterlaced TVs or filtered before they are displayed, when multiple suchimage objects are combined onto one screen, there are still visibleflutter artifacts at the horizontal top and bottom edges of theseobjects. While it is also possible to include filters in hardware tominimize visible flutter of the display, such filters are costly in thatthey require higher memory bandwidth from the display memory, since botheven and odd fields should preferably be read from memory for everydisplay field, and they tend to require additional logic and memoryon-chip.

One embodiment of the present invention includes a method of reducinginterlace flutter via automatic blending. This method has been designedfor use in graphics displays device that composites visible objectsdirectly onto the screen; for example, the device may use windows,window descriptors and window descriptor lists, or similar mechanisms.The top and bottom edges (first and last scan lines) of each object (orwindow) are displayed such that the alpha blend value (alpha blendfactor) of these edges is adjusted to be one-half of what it would be ifthese same lines were not the top and bottom lines of the window.

For example, a window may constitute a rectangular shape, and the windowmay be opaque, i.e. it's alpha blend factor is 1, on a scale of 0 to 1.All lines on this window except the first and last are opaque when thewindow is rendered. The top and bottom lines are adjusted so that, inthis case, the alpha blend value becomes 0.5, thereby causing theselines to be mixed 50% with the images that are behind them. Thisfunction occurs automatically in the preferred implementation. Since inthe preferred implementation, windows are rectangular objects that arerendered directly onto the screen, the locations of the top and bottomlines of every window are already known.

In one embodiment, the function of dividing the alpha blend values forthe top and bottom lines by two is implemented only for the top fieldsof the interlaced display. In another embodiment, the function ofdividing the alpha blend values for the top and bottom lines by two isimplemented only for the bottom fields of the interlaced display.

In the preferred embodiment, there exists also the ability to alphablend each window with the windows behind it, and this alpha value canbe adjusted for every pixel, and therefore for every scan line. Thesecharacteristics of the application design are used advantageously, asthe flutter reduction effect is implemented by controlling the alphablend function using information that is readily available from thewindow control logic.

In a specific illustrative example, the window is solid opaque white,and the image behind it is solid opaque black. In the absence of thedisclosed method, at the top and bottom edges of the window there wouldbe a sharp contrast between black and white, and when displayed on aninterlaced TV, significant flutter would be visible. Using the disclosedmethod, the top and bottom lines are blended 50% with the background,resulting in a color that is halfway between black and white, or gray.When displayed on an interlaced TV, the apparent visual location of thetop and bottom edges of the object is constant, and flutter is notapparent. The same effect applies equally well for other image examples.

The method of reducing interlace flutter of this embodiment does notrequire any increase in memory bandwidth, as the alternate field (theone not currently being displayed) is not read from memory, and there isno need for vertical filtering, which would have required logic andon-chip memory.

The same function can alternatively be implemented in different graphicshardware designs. For example in designs using a frame buffer(conventional design), graphic objects can be composited into the framebuffer with an alpha blend value that is adjusted to one-half of itsnormal value at the top and bottom edges of each object. Such blendingcan be performed in software or in a blitter that has a blendingcapability.

XI. Anti-Flutter Filtering/Vertical Scaling

In the preferred embodiment, the vertical filtering and anti-flutterfiltering are performed on blended graphics by one graphics filter. Onefunction of the graphics filter is low pass filtering in the verticaldimension. The low pass filtering may be performed in order to minimizethe “flutter” effect inherent in interlaced displays such astelevisions. The vertical downscaling or upscaling operation may beperformed in order to change the pixel aspect ratio from the squarepixels that are normal for computer, Internet and World Wide Web contentinto any of the various oblong aspect ratios that are standard fortelevisions as specified in ITU-R 601B. In order to be able to performvertical scaling of the upper layers the system preferably includesseven line buffers. This allows for four line buffers to be used forfiltering and scaling, two are available for progressing by one or twolines at the end of every line, and one for the current compositingoperation.

When scaling or filtering are performed, the alpha values in the linebuffers are filtered or scaled in the same way as the YUV values,ensuring that the resulting alpha values correctly represent the desiredalpha values at the proper location. Either or both of these operations,or neither, or other processing, may be performed on the contents of theline buffers.

Once the optional processing of the contents of the line buffers hasbeen completed, the result is the completed set of upper layers with theassociated alpha value (product of (1−A(i)). These results are useddirectly for compositing the upper layers with the lower layers, usingthe formula: Result=L(u)−AR(u)*L(1) as explained in detail in referenceto blending of graphics and video. If the lower layers require anyprocessing independent of processing required for the upper layers orfor the resulting image, the lower layers are processed before beingcombined with the upper layers; however in one embodiment of the presentinvention, no such processing is required.

Each of the operations described above is preferably implementeddigitally using conventional ASIC technology. As part of the normal ASICtechnology the logical operations are segmented into pipeline stages,which may require temporary storage of logic values from one clock cycleto the next. The choice of how many pipeline stages are used in each ofthe operations described above is dependent on the specific ASICtechnology used, the clock speed chosen, the design tools used, and thepreference of the designer, and may vary without loss of generality. Inthe preferred embodiment the line buffers are implemented as dual portmemories allowing one read and one write cycle to occur simultaneously,facilitating the read and write operations described above whilemaintaining a clock frequency of 81 MHz. In this embodiment thecompositing function is divided into multiple pipeline stages, andtherefore the address being read from the memory is different from theaddress being written to the same memory during the same clock cycle.

Each of the arithmetic operations described above in the preferredembodiment use 8 bit accuracy for each operand; this is generallysufficient for providing an accurate final result. Products are roundedto 8 bits before the result is used in subsequent additions.

Referring to FIG. 31, a block diagram illustrates an interaction betweenthe line buffers 504 and a graphics filter 172. The line bufferscomprises a set of line buffers 1-7 506 a-g. The line buffers arecontrolled by a graphics line buffer controller over a line buffercontrol interface 502. In one embodiment of the present invention, thegraphics filter is a four-tap polyphase filter, so that four lines ofgraphics data 516 a-d are provided to the graphics filter at a time. Thegraphics filter 172 sends a line buffer release signal 516 e to the linebuffers to notify that one to three line buffers are available forcompositing additional graphics display lines.

In another embodiment, line buffers are not used, but rather all of theupper layers are composited concurrently. In this case, there is onegraphics blender for each of the upper layers active at any one pixel,and the clock rate of the graphics blender may be approximately equal tothe pixel display rate. The clock rate of the graphics blenders may besomewhat slower or faster, if FIFO buffers are used at the output of thegraphics blenders.

The mathematical formulas implemented are the same as in the firstembodiment described. The major difference is that instead of performingthe compositing function iteratively by reading and writing a linebuffer, all layers are composited concurrently and the result of theseries of compositor blocks is immediately available for processing, ifrequired, and for blending with the lower layers, and line buffers arenot used for purposes of compositing.

Line buffers may still be needed in order to implement verticalfiltering or vertical scaling, as those operations typically requiremore than one line of the group of upper layers to be availablesimultaneously, although fewer line buffers are generally required herethan in the preferred embodiment. Using multiple graphics blendersoperating at approximately the pixel rate simplifies the implementationin applications where the pixel rate is relatively fast for the ASICtechnology used, for example in HDTV video and graphics systems wherethe pixel rate is 74.25 MHz.

XII. Unified Memory Architecture/Real Time Scheduling

Recently, improvements to memory fabrication technologies have resultedin denser memory chips. However memory chip bandwidth has not beenincreasing as rapidly. The bandwidth of a memory chip is a measure ofhow fast contents of the memory chip can be accessed for reading orwriting. As a result of increased memory density without necessarily acommensurate increase in bandwidth, in many conventional system designsmultiple memory devices are used for different functions, and memoryspace in some memory modules may go unused or is wasted. In thepreferred embodiment, a unified memory architecture is used. In theunified memory architecture, all the tasks (also referred to as“clients”), including CPU, display engine and IO devices, share the samememory.

The unified memory architecture preferably includes a memory that isshared by a plurality of devices, and a memory request arbiter coupledto the memory, wherein the memory request arbiter performs real timescheduling of memory requests from different devices having differentpriorities. The unified memory system assures real time scheduling oftasks, some of which do not inherently have predetermined periodicbehavior and provides access to memory by requesters that are sensitiveto latency and do not have determinable periodic behavior.

In an alternate embodiment, two memory controllers are used in a dualmemory controller system. The memory controllers may be 16-bit memorycontrollers or 32-bit memory controllers. Each memory controller cansupport different configuration of SDRAM device types and banks, orother forms of memory besides SDRAM. A first memory space addressed by afirst memory controller is preferably adjacent and contiguous to asecond memory space addressed by a second memory controller so thatsoftware applications view the first and second memory spaces as onecontinuous memory space. The first and the second memory controllers maybe accessed concurrently by different clients. The software applicationsmay be optimized to improve performance.

For example, a graphics memory may be allocated through the first memorycontroller while a CPU memory is allocated through the second memorycontroller. While a display engine is accessing the first memorycontroller, a CPU may access the second memory controller at the sametime. Therefore, a memory access latency of the CPU is not adverselyaffected in this instance by memory being accessed by the display engineand vice versa. In this example, the CPU may also access the firstmemory controller at approximately the same time that the display engineis accessing the first memory controller, and the display controller canaccess memory from the second memory controller, thereby allowingsharing of memory across different functions, and avoiding many copyoperations that may otherwise be required in conventional designs.

Referring to FIG. 32, a dual memory controller system services memoryrequests generated by a display engine 1118, a CPU 1120, a graphicsaccelerator 1124 and an input/output module 1126 are provided to amemory select block 1100. The memory select block 1100 preferably routesthe memory requests to a first arbiter 1102 or to a second arbiter 1106based on the address of the requested memory. The first arbiter 1102sends memory requests to a first memory controller 1104 while the secondarbiter 1106 sends memory requests to a second memory controller 1108.The design of arbiters for handling requests from tasks with differentpriorities is well known in the art.

The first memory controller preferably sends address and control signalsto a first external SDRAM and receives a first data from the firstexternal SDRAM. The second memory controller preferably sends addressand control signals to a second external SDRAM and receives a seconddata from the second external SDRAM. The first and second memorycontrollers preferably provide first and second data received,respectively, from the first and second external SDRAMs to a device thatrequested the received data.

The first and second data from the first and second memory controllersare preferably multiplexed, respectively, by a first multiplexer 1110 atan input of the display engine, by a second multiplexer 1112 at an inputof the CPU, by a third multiplexer 1114 at an input of the graphicsaccelerator and by a fourth multiplexer 1116 at an input of the I/Omodule. The multiplexers provide either the first or the second data, asselected by memory select signals provided by the memory select block,to a corresponding device that has requested memory.

An arbiter preferably uses an improved form of real time scheduling tomeet real-time latency requirements while improving performance forlatency-sensitive tasks. First and second arbiters may be used with theflexible real time scheduling. The real time scheduling is preferablyimplemented on both the first arbiter and the second arbiterindependently.

When using a unified memory, memory latencies caused by competing memoryrequests by different tasks should preferably be addressed. In thepreferred embodiment, a real-time scheduling and arbitration scheme forunified memory is implemented, such that all tasks that use the unifiedmemory meet their real-time requirements. With this innovative use ofthe unified memory architecture and real-time scheduling, a singleunified memory is provided to the CPU and other devices of the graphicsdisplay system without compromising quality of graphics or otheroperations and while simultaneously minimizing the latency experiencedby the CPU.

The methodology used preferably implements real-time scheduling usingRate Monotonic Scheduling (“RMS”). It is a mathematical approach thatallows the construction of provably correct schedules of arbitrarynumbers of real-time tasks with arbitrary periods for each of the tasks.This methodology provides for a straight forward means for proof bysimulation of the worst case scenario, and this simulation is simpleenough that it can be done by hand. RMS, as normally applied, makes anumber of simplifying assumptions in the creation of a priority list.

In the normal RMS assumptions, all tasks are assumed to have constantperiods, such that a request for service is made by the task with statedperiod, and all tasks have a latency tolerance that equals that task'speriod. Latency tolerance is defined as the maximum amount of time thatcan pass from the moment the task requests service until that task'srequest has been completely satisfied. During implementation of oneembodiment of the present invention, the above assumptions have beenmodified, as described below.

In the RMS method, all tasks are generally listed along with theirperiods. They are then ordered by period, from the shortest to thelongest, and priorities are assigned in that order. Multiple tasks withidentical periods can be in any relative order. In other words, therelative order amongst them can be decided by, for example, flipping acoin.

Proof of correctness, i.e. the guarantee that all tasks meet theirdeadlines, is constructed by analyzing the behavior of the system whenall tasks request service at exactly the same time; this time is calledthe “critical instant”. This is the worst case scenario, which may notoccur in even a very large set of simulations of normal operation, orperhaps it may never occur in normal operation, however it is presumedto be possible. As each task is serviced, it uses the shared resource,memory clock cycles in the present invention, in the degree stated bythat task. If all tasks meet their deadlines, the system is guaranteedto meet all tasks' deadlines under all conditions, since the criticalinstant analysis simulates the worst case.

When the lowest priority real-time task meets its deadline, without anyhigher priority tasks missing their deadlines, then all tasks are provento meet their deadlines. As soon as any task in this simulation fails tomeet its deadline, the test has failed and the task set cannot beguaranteed, and therefore the design should preferably be changed inorder to guarantee proper operation under worst case conditions.

In the RMS methodology, real-time tasks are assumed to have periodicrequests, and the period and the latency tolerance are assumed to havethe same value. Since the requests may not be in fact periodic, it isclearer to speak in terms of “minimum interval” rather than period. Thatis, any task is assumed to be guaranteed not to make two consecutiverequests with an interval between them that is any shorter than theminimum interval.

The deadline, or the latency tolerance, is the maximum amount of timethat may pass between the moment a task makes a request for service andthe time that the service is completed, without impairing the functionof the task. For example, in a data path with a constant rate source (orsink), a FIFO, and memory access from the FIFO, the request may occur assoon as there is enough data in the FIFO that if service is grantedimmediately the FIFO does not underflow (or overflow in case of a readoperation supporting a data sink). If service is not completed beforethe FIFO overflows (or underflows in the case of a data sink) the taskis impaired.

In the RMS methodology, those tasks that do not have specified real-timeconstraints are preferably grouped together and served with a singlemaster task called the “sporadic server”, which itself has the lowestpriority in the system. Arbitration within the set of tasks served bythe sporadic server is not addressed by the RMS methodology, since it isnot a real-time matter. Thus, all non-real-time tasks are servedwhenever there is resource available, however the latency of serving anyone of them is not guaranteed.

To implement real-time scheduling based on the RMS methodology, first,all of the tasks or clients that need to access memory are preferablylisted, not necessarily in any particular order. Next, the period ofeach of the tasks is preferably determined. For those with specificbandwidth requirements (in bytes per second of memory access), theperiod is preferably calculated from the bandwidth and the burst size.If the deadline is different from the period for any given task, that islisted as well. The resource requirement when a task is serviced islisted along with the task. In this case, the resource requirement isthe number of memory clock cycles required to service the memory accessrequest. The tasks are sorted in order of increasing period, and theresult is the set of priorities, from highest to lowest. If there aremultiple tasks with the same period, they can be given different,adjacent priorities in any random relative order within the group; orthey can be grouped together and served with a single priority, withround-robin arbitration between those tasks at the same priority.

In practice, the tasks sharing the unified memory do not all have trueperiodic behavior. In one embodiment of the present invention, a blockout timer, associated with a task that does not normally have a period,is used in order to force a bounded minimum interval, similar to aperiod, on that task. For example a block out timer associated with theCPU has been implemented in this embodiment. If left uncontrolled, theCPU can occupy all available memory cycles, for example by causing anever-ending stream of cache misses and memory requests. At the sametime, CPU performance is determined largely by “average latency ofmemory access”, and so the CPU performance would be less than optimal ifall CPU memory accessed were consigned to a sporadic server, i.e., atthe lowest priority.

In this embodiment, the CPU task has been converted into two logicaltasks. A first CPU task has a very high priority for low latency, and italso has a block out timer associated with it such that once a requestby the CPU is made, it cannot submit a request again until the block outtimer has timed out. In this embodiment, the CPU task has the toppriority. In other embodiments, the CPU task may have a very highpriority but not the top priority. The timer period has been madeprogrammable for system tuning, in order to accommodate different systemconfigurations with different memory widths or other options.

In one embodiment of the present invention, the block out timer isstarted when the CPU makes a high priority request. In anotherembodiment, the block out timer is started when the high priorityrequest by the CPU is serviced. In other embodiments, the block outtimer may be started at any time in the interval between the time thehigh priority request is made and the time the high priority request isserviced.

A second CPU task is preferably serviced by a sporadic server in around-robin manner. Therefore if the CPU makes a long string of memoryrequests, the first one is served as a high priority task, andsubsequent requests are served by the low priority sporadic serverwhenever none of the real-time tasks have requests pending, until theCPU block out timer times out. In one embodiment of the presentinvention, the graphics accelerator and the display engine are alsocapable of requesting more memory cycles than are available, and so theytoo use similar block out timer.

For example, the CPU read and write functions are grouped together andtreated as two tasks. A first task has a theoretical latency bound of 0and a period that is programmable via a block out timer, as describedabove. A second task is considered to have no period and no deadline,and it is grouped into the set of tasks served by the sporadic servervia a round robin at the lowest priority. The CPU uses a programmableblock out timer between high priority requests in this embodiment.

For another example, a graphics display task is considered to have aconstant bandwidth of 27 MB/s, i.e., 16 bits per pixel at 13.5 MHz.However, the graphics bandwidth in one embodiment of the presentinvention can vary widely from much less than 27 MB/s to a much greaterfigure, but 27 MB/s is a reasonable figure for assuring support of arange of applications. For example, in one embodiment of the presentinvention, the graphics display task utilizes a block out timer thatenforces a period of 2.37 μs between high priority requests, whileadditional requests are serviced on a best-effort basis by the sporadicserver in a low priority round robin manner.

Referring to FIG. 33, a block diagram illustrates an implementation of areal-time scheduling using an RMS methodology. A CPU service request1138 is preferably coupled to an input of a block out timer 1130 and asporadic server 1136. An output of the block out timer 1130 ispreferably coupled to an arbiter 1132 as a high priority servicerequest. Tasks 1-5 1134 a-e may also be coupled to the arbiter asinputs. An output of the arbiter is a request for service of a task thathas the highest priority among all tasks that have a pending memoryrequest.

In FIG. 33, only the CPU service request 1138 is coupled to a block outtimer. In other embodiments, service requests from other tasks may becoupled to their respective block out timers. The block out timers areused to enforce a minimum interval between two successive accesses byany high priority task that is non-periodic but may require expeditedservicing. Two or more such high priority tasks may be coupled to theirrespective block out timers in one embodiment of the present invention.Devices that are coupled to their respective block out timers as highpriority tasks may include a graphics accelerator, a display engine, andother devices.

In addition to the CPU request 1138, low priority tasks 1140 a-d may becoupled to the sporadic server 1136. In the sporadic server, these lowpriority tasks are handled in a round robin manner. The sporadic serversends a memory request 1142 to the arbiter for the next low prioritytask to be serviced.

Referring to FIG. 34, a timing diagram illustrates CPU service requestsand services in case of a continuous CPU request 1146. In practice, theCPU request is generally not continuous, but FIG. 34 has been providedfor illustrative purposes. In the example represented in FIG. 34, ablock out timer 1148 is started upon a high priority service request1149 by the CPU. At time t₀, the CPU starts making the continuousservice request 1146, and a high priority service request 1149 is firstmade provided that the block out timer 1148 is not running at time t₀.When the high priority service request is made, the block out timer 1148is started. Between time to and time t₁, the memory controller finishesservicing a memory request from another task. The CPU is first servicedat time t₁. In the preferred embodiment, the duration of the block outtimer is programmable. For example, the duration of the block out timermay be programmed to be 3 μs.

Any additional high priority CPU request 1149 is blocked out until theblock out timer times out at time t₂. Instead, the CPU low priorityrequest 1150 is handled by a sporadic server in a round robin mannerbetween time to and time t₂. The low priority request 1150 is active aslong as the CPU service request is active. Since the CPU service request1146 is continuous, another high priority service request 1149 is madeby the CPU and the block out timer is started again as soon as the blockout timer times out at time t₂. The high priority service request madeby the CPU at time t₂ is serviced at time t₃ when the memory controllerfinishes servicing another task. Until the block out timer times out attime t₄, the CPU low priority request 1150 is handled by the sporadicserver while the CPU high priority request 1149 is blocked out.

Another high priority service request is made and the block out timer1148 is started again when the block out timer 1148 times out at timet₄. At time t₅, the high priority service request 1149 made by the CPUat time t₄ is serviced. The block out timer does not time out until timet₇. However, the block out timer is not in the path of the CPU lowpriority service request and, therefore, does not block out the CPU lowpriority service request. Thus, while the block out timer is stillrunning, a low priority service request made by the CPU is handled bythe sporadic server, and serviced at time t₆.

When the block out timer 1148 times out at time t₇, it is started againand yet another high priority service request is made by the CPU, sincethe CPU service request is continuous. The high priority service request1149 made by the CPU at time t₇ is serviced at time t₈. When the blockout timer times out at time t₉, the high priority service request isonce again made by the CPU and the block out timer is started again.

The schedule that results from the task set and priorities above isverified by simulating the system performance starting from the“critical instant”, when all tasks request service at the same time anda previously started low priority task is already underway. The systemis proven to meet all the real-time deadlines if all of the tasks withreal-time deadlines meet their deadlines. Of course, in order to performthis simulation accurately, all tasks make new requests at everyrepetition of their periods, whether or not previous requests have beensatisfied.

Referring to FIG. 35, a timing diagram illustrates an example of acritical instant analysis. At time t₀, a task 1 1156, a task 2 1158, atask 3 1160 and a task 4 1162 request service at the same time. Further,at time to, a low priority task 1154 is being serviced. Therefore, thehighest priority task, the task 1, cannot be serviced until servicing ofthe low priority task has been completed.

When the low priority task is completed at time t₁, the task 1 isserviced. Upon completion of the task 1 at time t₂, the task 2 isserviced. Upon completion of the task 2 at time t₃, the task 3 isserviced. Upon completion of the task 3 at time t₄, the task 4 isserviced. The task 4 completes at time t₅, which is before the start ofa next set of tasks: the task 1 at t₆, the task 2 at t₇, the task 3 att₈, and the task 4 at t_(g).

For example, referring to FIG. 36, a flow diagram illustrates a processof servicing memory requests with different priorities, from the highestto the lowest. The system in step 1170 makes a CPU read request with thehighest priority. Since a block out timer is used with the CPU readrequest in this example, the block out timer is started upon making thehighest priority CPU read request. Then the system in step 1172 makes agraphics read request. A block out timer is also used with the graphicsread request, and the block out timer is started upon making thegraphics read request.

A video window read request in step 1174 and a video capture writerequest in step 1176 have equal priorities. Therefore, the video windowread request and the video capture write request are placed in a roundrobin arbitration for two tasks (clients). The system in step 1178 andstep 1180 services a refresh request and a audio read request,respectively.

While respective block out timers for the CPU read request and thegraphics read request are active, the system places the CPU read requestand the graphics read request in a round robin arbitration for fivetasks (clients), respectively, in step 1182 and step 1186. The system insteps 1184, 1188 and 1190 places other lowest priority tasks such as agraphics accelerator read/write request, a DMA read/write request and aCPU write request, respectively, in this round robin arbitration withfive clients.

XIII. Graphics Accelerator

Displaying of graphics generally requires a large amount of processing.If all processing of graphics is performed by a CPU, the processingrequirements may unduly burden the CPU since the CPU generally alsoperforms many other tasks. Therefore, many systems that perform graphicsprocessing use a dedicated processor, which is typically referred to asa graphics accelerator.

The system according to the present invention may employ a graphicsaccelerator that includes memory for graphics data, the graphics dataincluding pixels, and a coprocessor for performing vector typeoperations on a plurality of components of one pixel of the graphicsdata.

The preferred embodiment of the graphics display system uses a graphicsaccelerator that is optimized for performing real-time 3D and 2D effectson graphics and video surfaces. The graphics accelerator preferablyincorporates specialized graphics vector arithmetic functions formaximum performance with video and real-time graphics. The graphicsaccelerator performs a range of essential graphics and video operationswith performance comparable to hardwired approaches, yet it isprogrammable so that it can meet new and evolving applicationrequirements with firmware downloads in the field. The graphicsaccelerator is preferably capable of 3D effects such as real-time videowarping and flipping, texture mapping, and Gouraud and Phong polygonshading, as well as 2D and image effects such as blending, scaling,blitting and filling. The graphics accelerator and its caches arepreferably completely contained in an integrated circuit chip.

The graphics accelerator of the present invention is preferably based ona conventional RISC-type microprocessor architecture. The graphicsaccelerator preferably also includes additional features and somespecial instructions in the instruction set. In the preferredembodiment, the graphics accelerator is based on a MIPS R3000 classprocessor. In other embodiments, the graphics accelerator may be basedon almost any other type of processors.

Referring to FIG. 37, a graphics accelerator 64 receives commands from aCPU 22 and receives graphics data from main memory 28 through a memorycontroller 54. The graphics accelerator preferably includes acoprocessor (vector coprocessor) 1300 that performs vector typeoperations on pixels. In vector type operations, the R, G, and Bcomponents, or the Y, U and V components, of a pixel are processed inparallel as the three elements of a “vector”. In alternate embodiments,the graphics accelerator may not include the vector coprocessor, and thevector coprocessor may be coupled to the graphics accelerator instead.The vector coprocessor 1300 obtains pixels (3-tuple vectors) via aspecialized LOAD instruction.

The LOAD instruction preferably extracts bits from a 32-bit word inmemory that contains the required bits. The LOAD instruction alsopreferably packages and converts the bits into the input vector formatof the coprocessor. The vector coprocessor 1300 writes pixels (3-tuplevectors) to memory via a specialized STORE instruction. The STOREinstruction preferably extracts the required bits from the accumulator(output) register of the coprocessor, converts them if required, andpacks them into a 32-bit word in memory in a format suitable for otheruses within the IC, as explained below.

Formats of the 32-bit word in memory preferably include an RGB16 formatand a YUV format. When the pixels are formatted in RGB16 format, R has 5bits, G has 6 bits, and B has 5 bits. Thus, there are 16 bits in eachRGB16 pixel and there are two RGB16 half-words in every 32-bit word inmemory. The two RGB16 half-words are selected, respectively, viaVectorLoadRGB16Left instruction and VectorLoadRGB16Right instruction.The 5 or 6 bit elements are expanded through zero expansion into 8 bitcomponents when loaded into the coprocessor input register 1308.

The YUV format preferably includes YUV 4:2:2 format, which has fourbytes representing two pixels packed into every 32-bit word in memory.The U and V elements preferably are shared between the two pixels. Atypical packing format used to load two pixels having YUV 4:2:2 formatinto a 32-bit memory is YUYV, where each of first and second Y's, U andV has eight bits. The left pixel is preferably comprised of the first Yplus the U and V, and the right pixel is preferably comprised of thesecond Y plus the U and V. Special LOAD instructions, LoadYUVLeft andLoadYUVRight, are preferably used to extract the YUV values for the leftpixel and the right pixel, respectively, and put them in the coprocessorinput register 1308.

Special STORE instructions, StoreVectorAccumulatorRGB16,StoreVectorAccumulatorRGB24, StoreVectorAccumulatorYUVLeft, andStoreVectorAccumulatorYUVRight, preferably convert the contents of theaccumulator, otherwise referred to as the output register of thecoprocessor, into a chosen format for storage in memory. In the case ofStoreVectorAccumulatorRGB16, the three components (R, G, and B) in theaccumulator typically have 8, 10 or more significant bits each; theseare rounded or dithered to create R, G, and B values with 5, 6, and 5bits respectively, and packed into a 16 bit value. This 16 bit value isstored in memory, selecting either the appropriate 16 bit half word inmemory via the store address.

In the case of StoreVectorAccumulatorRGB24, the R, G, and B componentsin the accumulator are rounded or dithered to create 8 bit values foreach of the R, G, and B components, and these are packed into a 24 bitvalue. The 24 bit RGB value is written into memory at the memory addressindicated via the store address. In the cases ofStoreVectorAccumulatorYUVLeft and StoreVectorAccumulatorYUVRight, the Y,U and V components in the accumulator are dithered or rounded to create8 bit values for each of the components.

In the preferred embodiment, the StoreVectorAccumulatorYUVLeftinstruction writes the Y, U and V values to the locations in theaddressed memory word corresponding to the left YUV pixel, i.e. the wordis arranged as YUYV, and the first Y value and the U and V values areover-written. In the preferred embodiment, theStoreVectorAccumulatorYUVRight instruction writes the Y value to thememory location corresponding to the Y component of the right YUV pixel,i.e. the second Y value in the preceding example. In other embodimentsthe U and V values may be combined with the U and V values already inmemory creating a weighted sum of the existing and stored values andstoring the result.

The coprocessor instruction set preferably also includes aGreaterThanOREqualTo (GE) instruction. The GE instruction performs agreater-than-or-equal-to comparison between each element of a pair of3-element vectors. Each element in each of the 3-element vectors has asize of one byte. The results of all three comparisons, one bit per eachresult, are placed in a result register 1310, which may subsequently beused for a single conditional branch operation. This saves a lot ofinstructions (clock cycles) when performing comparisons between all theelements of two pixels.

The graphics accelerator preferably includes a data SRAM 1302, alsocalled a scratch pad memory, and not a conventional data cache. In otherembodiments, the graphics accelerator may not include the data SRAM, andthe data SRAM may be coupled to the graphics accelerator instead. Thedata SRAM 1302 is similar to a cache that is managed in software. Thegraphics accelerator preferably also includes a DMA engine 1304 withqueued commands. In other embodiments, the graphics accelerator may notinclude the DMA engine, and the DMA engine may be coupled to thegraphics accelerator instead. The DMA engine 1304 is associated with thedata SRAM 1302 and preferably moves data between the data SRAM 1302 andmain memory 28 at the same time the graphics accelerator 64 is using thedata SRAM 1302 for its load and store operations. In the preferredembodiment, the main memory 28 is the unified memory that is shared bythe graphics display system, the CPU 22, and other peripherals.

The DMA engine 1304 preferably transfers data between the memory 28 andthe data SDRAM 1302 to carry out load and store instructions. In otherembodiments, the DMA engine 1304 may transfer data between the memory 28and other components of the graphics accelerator without using the dataSRAM 1302. Using data SRAM, however, generally results in faster loadingand storing operations.

The DMA engine 1304 preferably has a queue 1306 to hold multiple DMAcommands, which are executed sequentially in the order they arereceived. In the preferred embodiment, the queue 1306 is fourinstructions deep. This may be valuable because the software (firmware)may be structured so that the loop above the inner loop may instruct theDMA engine 1304 to perform a series of transfers, e.g. to get two setsof operands and write one set of results back, and then the inner loopmay execute for a while; when the inner loop is done, the graphicsaccelerator 64 may check the command queue 1306 in the DMA engine 1304to see if all of the DMA commands have been completed. The queueincludes a mechanism that allows the graphics accelerator to determinewhen all the DMA commands have been completed. If all of the DMAcommands have been completed, the graphics accelerator 64 preferablyimmediately proceeds to do more work, such as commanding additional DMAoperations to be performed and to do processing on the new operands. Ifnot, the graphics accelerator 64 preferably waits for the completion ofDMA commands or perform some other tasks for a while.

Typically, the graphics accelerator 64 is working on operands andproducing outputs for one set of pixels, while the DMA engine 1304 isbringing in operands for the next (future) set of pixel operations, andalso the DMA engine 1304 is writing back to memory the results from theprevious set of pixel operations. In this way, the graphics accelerator64 does not ever have to wait for DMA transfers (if the code is designedwell), unlike a conventional data cache, wherein the conventional datacache gets new operands only when there is a cache miss, and it writesback results only when either the cache writes it back automaticallybecause it needs the cache line for new operands or when there is anexplicit cache line flush operation performed. Therefore, the graphicsaccelerator 64 of the present invention preferably reduces or eliminatesperiod of waiting for data, unlike conventional graphics acceleratorswhich may spend a large fraction of their time waiting for data transferoperations between the cache and main memory.

Referring to FIG. 38, an integrated circuit 1400 preferably includes oneembodiment of the system according to the present invention. Theintegrated circuit 1400 may include inputs 1412 for receiving threetransport channels of MPEG-2 Transport 1410, an analog input 1416 forreceiving an analog video 1414, an output 1428 for providing a videooutput signal 1426, and an output 1432 for providing an audio outputsignal 1430. In other embodiments, the system may be implemented usingtwo or more separate integrated circuit chips.

The integrated circuit 1400 may also include a bus 1420 forcommunicating with PCI devices 1418 and a bus 1424 to interface with i/odevices 1422 such as read-only memory (ROM), flash and/or other devices.The integrated circuit may further include a bus 1404 for transferringdata to and from memory 1402 and a bus 1408 for connecting to a CPU1406.

The system accepts video input signals that may include analog videosignals, digital video signals, or both. The analog video signals maybe, for example, NTSC, PAL and SECAM composite video signals or anyother conventional type of analog signal. The digital video signals mayinclude MPEG-2 video. The system may accept multiple channels of MPEG-2video. For example, the MPEG-2 Transport streams containing MPEG-2 videomay include three channels, two in-band channels and one out of bandchannel. The MPEG-2 Transport streams may also contain audio and datainformation. The system may also be capable of decoding and displayingMPEG-1 video.

The two in-band channels may be used for applications such as, forexample, picture-in-picture (PIP). The out of band channel may carryprivate data, which is any data that is not specified by the MPEGstandard. The private data may include program guides.

The MPEG-2 Transport streams (TS) may be provided over a cable, asatellite system or any combination of available media for transmittingMPEG-2 video, audio and data. The MPEG-2 Transport streams may include aDOCSIS (Data over Cable Services Interface Specification) component thatis preferably provided to the integrated circuit 1400 through a DOCSISreceiver. A DOCSIS-compliant cable modem generally uses unused 6 MHzvideo channels within the normal cable spectrum to receive DOCSIS data.One or both of the two in-band channels may carry a signal that isinterleaved between MPEG-2 video and DOCSIS data. The DOCSIS data mayinclude, for example, digital television data or HTML files.

The system may work with both the standard definition (SD) televisionand high definition (HD) television. During high definition mode, framesof picture may optionally be scaled horizontally in order to save memoryspace and bandwidth. In another embodiment, the frames may be scaledvertically.

Graphics data for display preferably is produced by any suitablegraphics library software, such as Direct Draw marketed by MicrosoftCorporation, and is read from the CPU 1406 into the memory 1402. Thevideo output signals 1426 may be analog signals, such as composite NTSC,PAL, Y/C (S-video), SECAM, RGB, YP_(R)P_(B), YC_(R)C_(B), or othersignals that may include video and graphics information. In an alternateembodiment, the system provides digital video output to an on-chip oroff-chip serializer that may encrypt the output.

The memory 1402 preferably is a unified memory that is shared by thesystem, the CPU 1406 and other peripheral components. The memory 1402may be implemented as a synchronous dynamic random access memory(SDRAM). The CPU preferably uses the unified memory for its code anddata while the system preferably performs all graphics, video and audioand display functions using the same unified memory.

FIG. 39 is a block diagram of one embodiment of the system of thepresent invention. The system preferably is implemented as a singleintegrated circuit chip 1400 comprised of an analog video decoder 1500,a video scaler 1502, an HD/Dual SD MPEG-2 video decoder 1504, an MPEG-2Transport processor with DVB and DES descramblers 1506, a bus bridge1508, an SDRAM controller 1510, a direct memory access (DMA) engine1512, a CPU interface & access caches 1514, a graphics & video displayengine 1516 with functions including HD display, format conversion andscaling, a graphics accelerator 1518, a Dolby & MPEG audio decoder 1520,a composite video encoder and HD ADCs 1522, a PCM audio 1524 and audioDac⅝s 1526.

The system preferably receives analog video through an analog videoinput 1528, MPEG Transport streams through an MPEG Transport input 1530,and I²S audio through an I²S audio input 1546. The system preferablyalso provides HD analog video through an HD analog video output 1542, SDanalog video through an SD analog video output 1544, analog audiothrough an analog audio output 1548, and digital audio through an SPDIFaudio output 1550. The system preferably communicates with other devicesthrough ISO7816 interfaces 1532, CPU bus 1534, PCI bus 1536, ROM & I/Obus 1538 and memory bus 1540.

The analog video decoder 1500 may accept NTSC, PAL, SCAM formatcomposite video as well as other conventional or non-conventional analogvideo such as S-video (a.k.a. y/c), RGB, YP_(R)P_(B) and YC_(R)C_(B)video. The analog video decoder preferably digitizes the analog videowith a 10-bit analog-to-digital converter (ADC). The analog videodecoder preferably decodes the digitized analog video using a 2Hadaptive comb filter and robust sync and video processing to produceinternal YUV component video signals. The YUV component video signalspreferably are processed through a time-base corrector (TBC) to providea stable graphics and digital video display simultaneously with decodedanalog video.

The video scaler 1502 preferably downscales and upscales decoded MPEG-2video and digitized analog video as needed. The scale factors may beadjusted continuously from a scale factor of much less than one to ascale factor of four or more. With both digitized analog and decodedMPEG-2 video input, either one may be scaled while the other isdisplayed full size at the same time.

The HD/Dual SD MPEG-2 video decoder 1504 preferably decodes all MPEG-2video streams that are compatible with Main Profile at Main Level(MP@ML), Main Profile at High Level (MP@HL), and 4:2:2 Profile at MainLevel (4:2:2@ML), including ATSC (Advanced Television Systems Committee)HDTV (high definition television) video streams, as well as all standarddigital cable and satellite streams. The HD/Dual SD MPEG-2 video decoder1504 may also decode MPEG-2 video streams that are compatible with otherprofiles such as main profile at High-1440 Level (MP@H14), 4:2:2 Profileat High Level (4:2:2@HL) and High Profile at High Level (HP@HL).

The HD/Dual SD MPEG-2 video decoder 1504 preferably is capable ofdecoding one video stream when decoding MPEG-2 HDTV video stream andmultiple video streams as tiled video and/or PIP video when decodingSDTV (standard definition television) video stream. For example, in oneembodiment, the video streams may include four video streams as tiledvideo and one video stream as a PIP video. The HD/Dual SD MPEG-2 videodecoder may also perform reduced-memory decoding of MPEG-2 HDTV videostreams for substantial savings in both memory size and memory bandwidthwhile retaining very high quality in both SDTV and HDTV display formats.

The MPEG-2 Transport processor with descramblers 1506 preferably is usedfor MPEG Transport processing including PID filtering, PSI sectionfiltering, clock recovery and packetized elementary stream (PES)parsing. The MPEG-2 Transport processor with descramblers 1506preferably also performs Digital Video Broadcasting (DVB) and DataEncryption Standard (DES) descrambling. The MPEG-2 Transport processorwith descramblers may also perform descrambling of transport streamsencrypted using other encryption methods. The MPEG-2 Transport processorwith descramblers 1506 may also include one or more ISO7816 smart cardor other interfaces for e-commerce and conditional access system use.

The MPEG-2 Transport processor with descramblers 1506 preferablyperforms processing of video and audio streams, MPEG system layerfunctions, and data section filtering and buffering for both standardand private section formats. The MPEG-2 Transport processor withdescramblers 1506 preferably performs processing of multiple data PID's(packet identification codes) and supports multiple section filterssimultaneously, in addition to supporting multiple video PID's, an audioPID, and a program clock reference (PCR) PID. In one embodiment, forexample, the MPEG-2 Transport processor and descramblers 1506 supports32 data PID's, 32 section filters and two video PID's.

The bus bridge 1508 allows the graphics processing system of the presentinvention to couple the host CPU to the peripheral devices including ROMand I/O devices as well as PCI devices.

The SDRAM controller 1510 preferably controls communications withexternal memory, e.g., SDRAM. The SDRAM preferably is organized into anunified memory architecture (UMA). The UMA preferably is implemented in64-bit wide SDRAM, and is used to perform all of the functions includingMPEG video decoding, graphics display, and CPU code and data storage.

This UMA design preferably facilitates substantial cost savings at thesystem level by supporting the use of mainstream high density SDRAMs andallowing the CPU and other functions to utilize this memory at the sametime that the memory is being used for MPEG decoding and graphicsdisplay. In other embodiments, the unified memory may support only asubset of functions performed by the system.

The DMA engine 1512 preferably allows data to be transferred between theCPU and components of the system without the involvement of CPUprocessing. Thus, the CPU is typically freed to perform other tasks. TheCPU interface & access caches 1514 preferably provides the interfacebetween the CPU and the system.

The graphics & video display engine 1516 preferably composites graphicswindows with video. The functions of the graphics & video display engine1516 preferably include HD display managing, format conversion andscaling. The graphics & video display engine preferably blends multiplegraphics windows in parallel to generate blended graphics.

The graphics accelerator 1518 preferably provides fully programmableacceleration for a variety of 3D and 2D effects and functions requiredby applications and Application Program Interfaces (APIs). The graphicsaccelerator 1518 preferably is implemented as a MIPS RISC processor withcustom instructions and a co-processor that performs vector graphiccomponent functions.

The Dolby & MPEG audio decoder preferably decodes both MPEG audio andDolby Digital audio streams. The Dolby & MPEG audio decoder preferablydecodes Dolby 5.1 channel streams and performs the Dolby specified twochannel mixdown with optional Pro-logic encoding. In MPEG audio mode,the digital audio decoder preferably decodes two channels in either MPEGLayer 1 or Layer 2. The digital audio decoder may output both analogstereo audio using on-board digital-to-analog converters (DACs) anddigital audio signals using Sony-Philips Digital Interface (SPDIF)serial output, in either compressed or uncompressed PCM format. Theaudio engine preferably also mixes decoded Dolby or MPEG audio with PCMaudio.

The composite video encoder and HD DACs 1522 preferably generates videooutputs that include both component (YP_(R)P_(B) and RGB) and encodedcomposite video, e.g., NTSC, PAL or SECAM format video, or Y/C (S-video)compatible formats. The composite video encoder and HD DACs 1522preferably is capable of converting digital video data into compositevideo blanking and sync (CVBS), Y/C video (S-video) and to componentYP_(R)P_(B) or RGB signals. The composite video encoder and HD DACs 1522preferably also digital-to-analog converts the video in CVBS, Y/C video(S-video), YP_(R)P_(B) or RGB format into analog video signal fordisplay. The composite video encoder and HD DACs 1522 may generate HDTVformat signals and SDTV format signals simultaneously.

FIG. 40 is a block diagram of another embodiment of the systemimplemented in an integrated circuit 1400. The system preferablyincludes a data transport 1600, a video transport 1602, a video RISC1604, two row RISCs 1606, 1608, an audio decode processor (ADP) 1614, agraphics accelerator 1624, a DMA engine 1626, a memory controller 1634,an analog video decoder (VDEC) with a 10-bit analog-to-digital converter(ADC) 1636, a video-graphics display and scale engine 1638, a set ofvideo DACs 1640, a PCI bridge 1642, an I/O bus bridge with DMA 1644, aCPU interface block 1646, a PCM audio 1650, an audio DAC 1652, and avideo encoder (VEC) 1654.

MPEG-2 Transport and decoding in the described embodiment preferably isperformed by the data transport 1600, the video transport 1602, thevideo RISC 1604, the row RISCs 1606, 1608, and the ADP 1614.

The system preferably includes multiple transport processors. Forexample, in one embodiment, the system may include three transportprocessors. The data transport 1600 performs descrambling of encryptedtransport streams. The encrypted transport streams may have beenencrypted using, e.g., DES, DVD or other encryption method. In addition,the data transport 1600 preferably extracts message data and stores thedata in an external memory, e.g., SDRAM. The video transport 1602preferably extracts bit stream for MPEG-2 video. The audio decodeprocessor (ADP) 1614 preferably has a transport function dedicated toextracting audio bit streams.

In-band MPEG Transport streams IB 1 (in-band 1) and IB 2 (in-band 2) areprovided to the data transport 1600 and the video transport 1602. Anout-of-band MPEG Transport stream OOB preferably is provided to the datatransport 1600, and it may also be provided to the video transport 1602.

Thus, the data transport 1600 preferably receives three channels of MPEGTransport streams. The data transport 1600 preferably performs PID andsection filtering of the transport streams. The data transport 1600provides message data obtained through section filtering to the memorycontroller 1634 for storage in the external memory, e.g., SDRAM. Thedata transport 1600 preferably also performs descrambling of thetransport streams including DES, DVB and/or other descrambling methods.In one embodiment of the present invention, the data transport 1600provides the descrambled transport streams to the video transport 1602and the ADP 1614.

The video transport 1602 preferably receives two in-band MPEG Transportstreams and one out-of-band MPEG Transport stream. The video transport1602 preferably extracts compressed MPEG video data by removingtransport stream (TS) headers and packetized elementary stream (PES)headers from the input transport streams. Then the video transport 1602preferably provides the compressed MPEG video data for processing in thevideo RISC 1604.

In other embodiments, the data transport 1600, the video transport 1602and the ADP 1614 may receive other types of compressed data streams,which may include packetized compressed data streams. For example, thecompressed data streams may include one or more DIRECTV transportstreams. DIRECTV is a trademark of DIRECTV, Inc.

The video RISC 1604 and the row RISCs 1606, 1608 make up an MPEG videodecoder. The MPEG video decoder preferably decodes the compressed MPEGvideo data and provides it to the memory controller 1634 to be storedtemporarily in an external memory, e.g., SDRAM. Complex video decodeprocess of MPEG video preferably is partitioned into concurrentlyoperable multiple decode functionality. The MPEG video decoderpreferably decodes multiple rows of the compressed MPEG video dataconcurrently.

The video RISC 1604 preferably parses and processes layers of compressedMPEG video data above the SLICE layer, i.e., SEQUENCE, group of pictures(GOP), EXTENSION and PICTURE layers. The two row RISCs 1606, 1608preferably are used for SLICE layer, macroblock layer and block layerdecoding and processing. Row decode paths associated with the row RISCspreferably are used for full speed processing of time critical functionsat the macroblock and block layers. Processors used in the describedembodiment are RISC processors. Other types of processors may be used inother embodiments.

The MPEG video decoder may scale frames by half when saving them toframe buffers. Thus, savings to memory size and bandwidth may resultwhen the reference frames are saved for reconstruction of P-frames andB-frames. The frames preferably are not scaled vertically duringreconstruction. The frame buffers preferably are implemented in externalmemory.

The audio decode processor (ADP) 1614 performs audio PID parsing toextract audio packets from the transport streams. The ADP 1614preferably decodes the audio packets extracted from the transportstreams. The ADP 1614 provides the decoded audio data to the PCM audio1650 for mixing with other audio signals.

The register bus bridge 1616 preferably provides interface between theinternal CPU-register bus and the memory controller 1634. In oneembodiment, the system uses 16-bit registers. In other embodiments, thesystem may use registers having other bit sizes.

The graphics accelerator 1624 preferably performs graphics operationsthat may require intensive CPU processing, such as operations on threedimensional graphics images. The graphics accelerator 1624 preferably isimplemented as a RISC processor optimized for performing real-time 3Dand 2D effects on graphics and video surfaces. The graphics acceleratorpreferably incorporates specialized graphics vector arithmetic functionsfor maximum performance with video and real-time graphics.

The graphics accelerator preferably performs a range of essentialgraphics and video operations with performance approaching that ofhardwired approaches. At the same time, the graphics accelerator may beprogrammable so that it may meet new and evolving applicationrequirements with firmware downloads in the field.

The DMA engine 1626 preferably transfers data between the CPU andcomponents of the system without interrupting the CPU. For example, CPUread and write operations as illustrated in CPU R/W block 1618 areperformed by the DMA engine 1626.

The memory controller 1634 preferably reads and writes video andgraphics data to and from memory by using burst accesses with burstlengths that may be assigned to each task. The memory preferably is anysuitable memory such as an SDRAM. All functions within the systempreferably share the same memory having a unified memory architecture(UMA), with real-time performance of all of the hard real timefunctions. CPU accesses of code and data preferably are performed asquickly and efficiently as possible without impairing the video,graphics, and audio functions. Memory preferably is utilized veryefficiently by performing burst accesses with burst lengths optimizedfor each task, and through careful optimization of the memory accesspatterns for MPEG video decoding.

The analog video decoder (VDEC) 1636 preferably digitizes and processesanalog input video to produce internal YUV component signals havingseparated luma and chroma components. The VDEC 1636 preferably takes inan analog video and decodes this video into digital component signals.The analog video received by the VDEC 1636 may be in one or more of thefollowing formats or any other conventional or non-conventional format:NTSC, PAL, SECAM, RGB, Y/C video (S-video), YP_(R)P_(B) and YC_(R)C_(B).

The VDEC 1636 preferably includes a 10-bit CMOS video analog-to-digitalconverter (ADC) to digitize analog video directly. The VDEC 1636 mayalso include internal anti-aliasing filters which allow simpleconnections of normal analog video to the system. The VDEC 1636preferably separates luminance and chroma using an adaptive 2H (3 line)comb filter, adaptive edge enhancement and noise coring.

The video-graphics display and scale engine 1638 takes graphicsinformation from memory, blends the graphics information, and compositesthe blended graphics with video. The video-graphics display and scaleengine 1638 preferably provides the component video, e.g., RGB,YP_(R)P_(B) and YC_(R)C_(B), to the set of video DACs 1640 fordigital-to-analog conversion. In one embodiment, the set of video DACs1640 includes five DACs.

The video-graphics display and scale engine 1638 preferably provides thecomposite video, e.g., NTSC, PAL, Y/C video (S-video), to the VEC 1654for conversion into proper signal format. The VEC 1654 preferablyprovides the formatted composite video to the set of video DACs 1640 tobe converted to analog format. In another embodiment, the VEC 1654includes a set of video DACs, and thus the formatted composite video isconverted to analog video in the VEC 1654.

The set of video DACs 1640 preferably provide multiple digitized videooutputs. The multiple digitized video outputs may include componentvideo such as RGB and YP_(R)P_(B), in addition to composite video invarious formats such as composite video blanking and sync (CVBS)including NTSC and PAL composite video, and Y/C video (S-video). In oneembodiment, the set of video DACs 1640 includes five video DACs, andthus all of Y/C video, CVBS video and standard definition componentvideo may be displayed simultaneously.

The video-graphics display and scale engine 1638 preferably supportscapturing of video as illustrated in a capture block 1620 and preferablyreads graphics from the external memory, e.g., SDRAM, as illustrated ina graphics read block 1622. Decoded MPEG-2 video preferably is providedto the video-graphics display and scale engine 1638 as indicated in MPEGdisplay feeder blocks 1 and 2 1628, 1630. The video-graphics display andscale engine 1638 preferably also receives a video window 1632.

The video-graphics display and scale engine 1638 preferably alsoperforms both downscaling and upscaling of MPEG video and analog videoas needed. The scale factors may be adjusted continuously from a scalefactor of much less than one to a scale factor of four or more. Withboth analog and MPEG video input, either one may be scaled while theother is displayed full size at the same time. Any portion of the inputmay be the source for video scaling. To conserve memory and bandwidth,the video-graphics display and scale engine 1638 preferably downscalesbefore capturing video frames to memory, and upscales after reading frommemory. The video-graphics display and scale engine 1638 may scale boththe HDTV video and SDTV video.

In one embodiment, the video-graphics display and scale engine 1638provides HDTV video to be displayed while scaling the HDTV video downinto SDTV format, and capturing into memory. The HDTV video may bescaled and captured as an SDTV video either before or after compositingwith graphics. The HDTV video may also be scaled and captured as an SDTVvideo both before and after compositing with graphics. The scaled andcaptured HDTV video may be recorded, e.g., using a standard videocassette recorder (VCR), while the HDTV video is being displayed on TV.

A system bridge controller 1648 preferably provides a “north bridge”function by providing a bridge for the CPU to interface with multipleperipheral devices. The system bridge controller preferably is comprisedof the PCI (Peripheral Component Interconnect) bridge 1642, the I/O busbridge with DMA 1644 and the CPU interface block 1646.

The PCM audio 1650 preferably receives decoded MPEG or Dolby AC-3 audiofrom the ADP 1614. The PCM audio 1650 preferably also receives I²S audiothrough an I²S input 1662 and digitizes and captures it for mixing withother audio data. The PCM audio 1650 preferably supports applicationsthat create and play audio locally within a set top box and allow mixingof the locally created audio with audio from a digital audio source,such as the MPEG audio or Dolby AC-3, and with digitized analog audio.

The PCM audio 1650 preferably plays audio from an SDRAM in a variety ofsample rates and formats. Both the captured analog audio and the localPCM audio may be played and mixed at the same time, even though they mayhave different sample rates and formats. The PCM audio 1650 preferablyalso provides digital audio output 1676 in, e.g., SPDIF serial outputformat.

The audio DAC 1652 provides the decoded and digital-to-analog convertedMPEG and Dolby AC-3 audio component as an analog audio output 1674 ofthe system. The analog audio output 1674 may also include other audioinformation such as I²S audio.

The VEC 1654 converts between the HD video color space (YP_(R)P_(B)) andthe standard definition YUV color space, and between either of those andRGB before converting to the respective outputs. For example, video thatwas originally coded using YP_(R)P_(B) may be displayed in YP_(R)P_(B)for direct HD output, or converted to YUV for SD display via composite,Y/C or direct RGB output. This function preferably is availableregardless of the resolution of the video. Video that was originallycoded using YUV may be output as composite, Y/C or RGB, or converted toYP_(R)P_(B) for direct HD output.

The HD YP_(R)P_(B) component output may support the specified tri-levelsync. The RGB output may also support optional sync on green, sync onRGB, or separate H and V sync on 2 Y/CVBS and C outputs, to supportvarious types of standard definition and HD monitors.

FIG. 41 is a block diagram that illustrates distribution of in-band andout-of-band transport streams in one embodiment of the presentinvention. In the described embodiment, the in-band transport streams 1and 2 are provided to multiplexers 1610 and 1612. The multiplexer 1610provides output to the data transport 1600 while the multiplexer 1612provides output to the video transport 1602. The in-band transportstreams 1 and 2 provided to the data transport 1600 and the transportRISC 1602 through the multiplexers 1610 and 1612, respectively,preferably include sync and data information. The out-of-band transportstream preferably is provided, without multiplexing, to both the datatransport 1600 and the video transport 1602.

In the described embodiment, clocks for the in-band transport streams 1and 2 preferably are provided to a multiplexer 1680. The multiplexer1680 multiplexes the clocks and provides the multiplexed output to thedata transport 1600, the video transport 1602 and the ADP 1614 asappropriate. For example, when the in-band transport stream 1 isprocessed in the video transport 1602, the in-band 1 clock is providedto the video transport 1602.

In alternate embodiments, all three of the in-band 1 transport stream,in-band 2 transport stream and the out-of-band transport stream may beprovided simultaneously to one or more of the data transport 1600, thevideo transport 1602 and the ADP 1614. The in-band clock 1 and thein-band clock 2 may also be provided simultaneously to one or more ofthe data transport 1600, the video transport 1602 and the ADP 1614.

In one embodiment of the present invention, decrypting, e.g., DataEncryption Service (DES) or Digital Video Broadcasting (DVB)descrambling, of the transport streams is performed by the datatransport 1600. Thus, when the video transport 1602 or the ADP 1614processes the crypted, e.g., DES or DVB scrambled, transport stream, thecrypted transport stream is first decrypted by the data transport 1600and provided to the video transport and the ADP, respectively. In otherembodiments, the video transport and the ADP may have decryptioncapabilities as well.

XIV. Data Transport Processor

FIG. 42 is a block diagram of a data transport 1600 in one embodiment ofthe present invention. The data transport 1600 preferably performsdescrambling of the MPEG Transport streams. The descrambling may includeDES and DVB descrambling as well as descrambling of transport streamsencrypted using other encryption methods. The data transport 1600preferably provides the descrambled MPEG Transport streams to a videotransport, such as the video transport 1602 of FIG. 41, and an audiodecode processor (ADP), such as the ADP 1614 of FIG. 41. The datatransport 1600 preferably also extracts message data from the inputstreams and transfers them to an external memory, e.g., SDRAM. Theexternal memory may be configured as 32, 64 or other suitable number ofcircular memory buffers.

An MPEG Transport stream typically includes fixed-length transportpackets. Each transport packet is typically 188 bytes long. The datatransport 1600 preferably is an MPEG-2 Transport stream message/PESparser and demultiplexer. The data transport 1600 preferably is capableof simultaneously receiving and processing three independent serialtransport streams, two in-band (IB) streams and one out-of-band (OOB)stream. The data transport 1600 preferably has transport packetprocessing throughput of 81 Mbps. In other embodiments, the datatransport may be capable of receiving more or less than threeindependent serial transport streams, and the transport packetprocessing throughput may be more or less than 81 Mbps.

The data transport 1600 preferably performs filtering of multiple, e.g.,32, PID's for message or PES processing. In other embodiments, datatransport 1600 may filter more or less than 32 PID's, e.g., up to 64PID's. In addition, the data transport 1600 preferably includes 32 PSIsection filters for processing of MPEG or DVB sections. In otherembodiments, the data transport may filter more or less than 32sections, e.g., up to 64 sections. The sections may include programspecific information (PSI) and/or private sections.

The data transport 1600 typically receives the MPEG Transport streams atdifferent data rates. For example, the out-of-band transport stream istypically received synchronized to a 3.5 MHz clock. The in-bandtransport streams are typically received synchronized to a clock havinga frequency range of, e.g., 1 to 60 MHz. Since the data transport 1600in the described embodiment operates at a fixed frequency, e.g., 40.5MHz or 81 MHz, the three transport streams are received by three inputsynchronizers 1702 a-c.

The three input synchronizers 1702 a-c preferably synchronize incomingMPEG-2 Transport packets to the data transport clock. In otherembodiments, the data transport 1600 may operate at different clockfrequencies. Each input synchronizer preferably includes aserial-to-parallel converter for converting incoming data into parallel,e.g., byte-wise, format.

From the input synchronizers 1702 a-c, the transport streams preferablyare provided to parsers 1706 a-c, which may also be called PID filters.The parsers 1706 a-c preferably compare the PID's of the incomingtransport streams with the PID's in the PID table 1708 to extract onlythe data associated with the PID's found in the PID table 1708. Theparsers 1706 a-c preferably also perform error checking, such ascontinuity error checking, to ensure that the received transport packetsdo not contain error.

The PID table 1708 preferably includes 32 PID's. In other embodiments,the PID table 1708 may include more or less than 32 PID's, e.g., 64PID's. Some of the PID's may be filtered by hardware for increasedthroughput, while some other PID's may be filtered by programmablefirmware for increased flexibility. Entries in the PID table may bearbitrarily assigned to any of the three transport streams. Each of thethree transport streams preferably are processed uniquely, even in caseswhen two or more of the transport streams contain the same PID.

The synchronizers 1702 a-c preferably also provide the synchronizedtransport streams to a high speed interface module 1730. The high speedinterface module 1730 preferably also receives parsed transport streams1738 of all three of the transport streams: IB 1, IB 2 and OOB. Theparsed transport streams 1738 preferably are provided by the parsers1706 a-c. In addition, the high-speed interface module 1730 preferablyreceives clocks 1740 for all three of the synchronized transportstreams.

The high speed interface module 1730 preferably also receives a channel1 stream 1742 and a channel 2 stream 1744. The channel 1 stream 1742 andchannel 2 stream 1744 are provided by output buffers 1732 and 1734 asoutputs 1756 and 1758, respectively. Further, the high speed interfacemodule 1730 preferably receives the decrypted parsed transport streams,which have been decrypted by a descrambler 1712 and provided as anoutput.

With all these inputs, the high speed interface module 1730 preferablyprovides an output 1754. The output 1754 may include one or more of thesynchronized transport streams, the parsed transport streams 1738, thedecrypted parsed transport streams, the clocks 1740 and the channel 1and channel 2 streams 1742 and 1744. The output 1754 of the high speedinterface 1730 preferably is provided to a port as an output of thesystem, e.g., integrated chip, of the present invention.

Register variables within the data transport 1600 preferably are storedin registers 1700. The registers 1700 preferably are on a register busof the system.

The parsers 1706 a-c preferably also provide the parsed transportstreams to an input buffer 1710. The input buffer 1710 preferably iscapable of storing up to eight 188-byte MPEG-2 Transport packets. Inother embodiments, the number of transport packets stored in the inputbuffer 1710 may be more or less than eight. The input buffer 1710preferably outputs to a descrambler 1712.

The descrambler 1712 preferably performs DES and DVB descrambling. Thedescrambler 1712 may also be used to decrypt transport streams encryptedusing other encrypting methods. The descrambler 1712 preferably receiveskey data for decrypting from a key table 1714. Each of the encryptedinput transport streams preferably is decrypted using DES, DVB or otherdescrambling methods. Type of descrambling performed on each transportstream preferably is selectable. For decryption, even and odd keyspreferably are provided. Each PID preferably is associated with adifferent key. The keys typically are 64 bits in size, however, they maybe 56 or other number of bits in size in some embodiments.

The output of the descrambler 1712 preferably is also provided to thebuffers 1732 and 1734. In addition to receiving the output of thedescrambler 1712, the buffers 1732 and 1734 preferably are provided witha first audio hold signal 1746 and a second audio hold signal 1748,respectively. All three transport streams, IB 1, IB 2 and OOB transportstreams, preferably are included in a decrypted parsed transport streamoutput of the descrambler 1712. In other embodiments, one or two, butnot all three of the transport streams may be included in the output ofthe descrambler 1712.

The buffers 1732 and 1734 preferably provide channel 1 and channel 2outputs 1756 and 1758, respectively. The channel 1 and channel 2 outputsmay be provided to the video transport 1602 or to the audio decodeprocessor (ADP) 1614. When decrypted parsed transport streams from thebuffers 1732 and 1734 are received by the video transport and the ADP,the video transport and the ADP determine whether the incoming data isvideo or audio and process them accordingly.

In one embodiment, the video transport is capable of processing videodata from both the output buffer 1732 and the output buffer 1734. Thedata transport and the video transport are capable of processing theincoming MPEG-2 Transport streams to display multiple videosimultaneously in, e.g., picture-in-picture (PIP) or tile format. TheADP preferably extracts audio data from one or the other of the outputchannels 1 and 2 1756 and 1758. In other embodiments, the ADP mayextract audio data from both the channels 1 and 2.

The first audio hold and second audio hold signals preferably areprovided by the audio decode processor (ADP). The first audio holdsignal indicates to the buffer 1732 that an audio buffer, e.g., in theADP, receiving the channel 1 output 1756 requests that the output 1756be held until the audio buffer is ready to receive the output 1756again. Similarly, the second audio hold signal indicates to the outputbuffer 1734 that the audio buffer, e.g., in the ADP, requests that thechannel 2 output 1758 be held. Thus, the first and second audio holdsignals preferably safeguard against overflow of the audio buffer.

The input synchronizers 1702 a-c preferably also provide synchronizedtransport streams to a PCR recovery module 1728 for extraction ofprogram clock information (PCRs). The PCR recovery module 1728preferably extracts the PCRs from the transport streams and outputs as aprogram clock reference (PCR) output 1736. Maintaining upstream timingsynchronicity is typically important when playing transmitted programsdirectly, and the availability of a local reference clock generallyallows playback synchronicity between video and audio. Thus, the PCRoutput 1736 preferably is provided simultaneously to downstream devicesincluding but not limited to the video transport 1602, the ADP 1614 andother synchronous devices. Using the PCR output 1736, the downstreamdevices may operate in a time synchronous manner with one another, thedata transport 1600 and upstream devices that use the program clock,e.g., an upstream transmitter.

The PCR recovery module 1728 may extract PCRs from transport streamshaving different formats including but not limited to MPEG Transportstreams and DIRECTV transport streams. The PCR output 1736 preferably isa serial output signal as to conserve chip area. In other embodiments,the PCR output 1736 may be a parallel output signal.

The program clock information (PCRs) extracted from the MPEG Transportstream preferably is loaded into a counter and may be used to lock thesystem clock of the data transport 1600 to the program clock. This way,a timing relationship can be maintained between the data transport 1600and the upstream transmitter. The PCRs may typically be extracted fromthe input streams at any time, and sent to the downstream devices eitheras they are available or only at discontinuities. The discontinuitiesmay exist in the recovered PCRs, for example, when the transport streamsinclude elementary streams generated using different program referenceclocks.

A decision circuitry preferably is used to send some or all of the PCRsto the downstream devices such as the video transport 1602 or the ADP1614. The ADP typically requires a PCR only in the cases when there is achannel change or a PCR discontinuity. The ADP preferably has its ownlocal PCR counter which typically is re-loaded under these conditions.Thus, for example, only the PCRs loaded into a local PCR counter, whichmay also be referred to as a system time clock (STC) counter, aretypically provided to the ADP 1614. The PCRs may also be sent to thedownstream devices at other intervals.

The PCR output 1736 preferably is also provided to an external DAC(PCRDAC) for digital-to-analog conversion. Thedigital-to-analog-converted program clock reference output is providedto a voltage control oscillator (VCXO) to adjust the voltage level tocontrol the VCXO frequency, which in turn adjusts the system clock tolock to the program clock. The data transport may include the PCRDAC inother embodiments. In still other embodiments, the PCRDAC may beincluded in one of the downstream devices such as the video transport.

In other embodiments, the PCR output 1736 may be programmed by a hostCPU, so as to create a reference clock locally, instead of, or inaddition to, extracting PCRs from the input streams. For this purpose,the host CPU preferably performs a “direct load” function, in which thehost CPU programs serial PCRs that are sent rather than have the PCRsextracted from the input streams. Thus, the mode to transmit theextracted PCRs may be overridden by a mode to transmit user definedPCRs, i.e., programmed PCR output.

The descrambler 1712 preferably also provides the decrypted parsedtransport streams to a PES parser 1718. The PES parser 1718 preferablyparses the decrypted parsed transport streams and provides the PESheader and data to the DMA controller 1724 for storage in the externalmemory, e.g., the circular memory buffers implemented in SDRAM. Inanother embodiment, the output of the PES parser 1718 is not stored inthe external memory. Instead, the output of the PES parser 1718 providesaudio and video streams to the video transport 1602 and the ADP 1614,respectively. In the described embodiment, the data streams are providedto the in-band 1 channel or the in-band 2 channel, respectively, of thevideo transport 1602.

The PES parser may perform PES packet extraction for any of the PIDchannels. In other embodiments, there may be more, e.g., 64, or less PIDchannels. There are 32 (or 64) PID's for all three input transportstreams, spanning across all three channels. The packetized elementarystream (PES) parser 1718 preferably looks at the PES header to determinethe length of the PES stream, and thereby figure out the end of the PESstream.

The descrambler 1712 preferably also provides the decrypted parsedtransport streams to a PSI filter 1720. The PSI filter preferably is athirteen-byte filter with an associated mask. The PSI filter 1720, inthe first part of the section, selectively filters messages out of thedata stream of the current PID and provides to the DMA controller 1724to be written to the external memory, e.g., the circular memory buffers.Thus, the PSI filtering extract messages from the transport streams. ThePSI filter 1720 preferably uses PSI filter data from a PSI table 1722for filtering.

The PSI filter 1720 preferably is comprised of 32 section byte-comparefilters. Each of the 32 section byte-compare filters preferably has acapability to filter 13 bytes as well as a mask per bit feature. In thedata transport 1600, each PID channel may independently select anynumber of section byte-compare filters, where each filter may be used bymultiple PID channels. The data extracted by the PSI filter 1720 fromthe out-of-band and in-band transport streams preferably stored in oneof circular memory buffers. For example, in one embodiment, there may be64 circular memory buffers. The output of the PSI filter 1720 preferablyis provided to the external memory through the DMA controller 1724 overa 64-bit bus. In other embodiments, the bus width may be different from64, e.g., the bus may be a 128-bit bus.

The circular memory buffers may be distributed between message data fromthe PSI filter 1720 and video/audio data from the PES parser 1718. Forexample, 64 circular memory buffers in one embodiment may be configuredinto all PES data memory buffers. For another example, 64 circularmemory buffers may be apportioned between the PES data and the PSIdata—62 PES data buffers and 2 PSI data buffers or any otherdistribution between the PES data buffers and the PSI data buffers. Inaddition, the data transport 1600 preferably performs a cyclicredundancy check (CRC) to verify correctness of the data. The CRC isassociated with the PSI filter 1720.

Each of the circular memory buffers may be 1K, 2K, 4K, 8K, 16K, 32K, 64Kor 128 K bytes in size. In other embodiments, the size of the circularmemory buffers may have other suitable size. Each of the circular memorybuffers preferably is associated with a PID channel. For out-of-bandpackets, PID channels with duplicate PID's are allowed to output todifferent circular memory buffers.

The data transport 1600 preferably also includes a special addressingmode for filtering of proprietary messages including but not limited to:message type range, single cast-unit address, network 40 address,multicast 40 address, multicast 24 address, multicast 16 address andindependent wild cards for the network 40 and multicast 40 address.

FIG. 43 is a block diagram of an alternate embodiment of the datatransport. The data transport 1601 is similar to the data transport 1600except that the data transport 1601 may store complete transport packetsin the external memory and playback the stored transport packets whendesired.

In addition to the elements of the data transport 1600, the datatransport 1601 in FIG. 43 includes multiplexers 1704 a-c, a transportrecorder 1716 and a playback circuit (PVR) 1726. During normaloperation, the multiplexers 1704 a-c select the transport streams fromthe input synchronizers 1702 a-c, and thus the data transport 1601operates similarly to the data transport 1600 of FIG. 43.

The transport recorder 1716 may store complete transport packets in thecircular memory buffers through the DMA controller 1760. Data associatedwith one PID is typically stored in a circular memory buffer. When therecord channels are used, one or more of the circular memory bufferspreferably are configured for taking transport stream inputs. Thus, dataassociated with the PID's in the transport stream may be placed into asingle circular memory buffer. In one embodiment, a single circularmemory buffer may contain data associated with up to 64 PID's. In otherembodiments, a single circular memory buffer may contain data associatedwith more or less than 64 PID's.

The playback circuit (PVR) 1726 may operate in either MPEG mode orDIRECTV mode. The PVR 1726 preferably performs DMA function oftransferring data from the external memory, e.g., the circular memorybuffers in SDRAM, into the data transport 1601. During the playbackmode, the PVR 1726 receives the stored transport packets from theexternal memory and provides to the buffers 1 and 2 1732 and 1734, thehigh speed interface module 1730, the PCR recovery module 1728 and themultiplexers 1704 a-c. During this mode, the multiplexers 1704 a-cprovide the stored transport packets to the parsers 1706 a-c. Both thetransport recorder 1716 and the PVR 1126 preferably have two channels:channel 1 and channel 2. Either channel may be used to store andplayback the transport packets.

Unlike in the normal operation, where PCRs preferably are extracted fromthe input transport streams, during playback, the PCRs preferably arederived from program time stamps (PTS) of the playback stream. This isdue to the fact that the packets with PCR information may not have beenrecorded by the transport recorder 1716. Further, even if they have beenrecorded, the playback stream is not necessarily played back at aregular rate so that the PCRs may not arrive at proper intervals to beused in a manner that they are designed to be used. For the playbackoperation, since the PCRs are still needed decoding video and audio, avirtual PCR may be constructed by looking at the PTS information fromthe input streams. This user defined PCR may then be delivered to thevideo decoder by utilizing the serial PCR “direct load” capability,which has been discussed earlier.

Unlike directly transmitted data, e.g., in transport streams, which issynchronous because of the PCRs, the playback data is available frommemory, potentially at a much higher rate than that required for theactual bit stream. This can cause an overflow of the video buffers. Inone embodiment, during playback, two methods are available to preventthis overflow. These two methods preferably allow the video decoder toreceive data only as they are needed.

The first method uses a throttling mechanism, allowing the playbackstream to be sent at a data rate not faster than the maximum data rate,which may be programmed by the host CPU. This allows controlled bit rateand byte interval commensurate with the processing capabilities of thevideo decoder, which typically have a limit to input data rate. Thus,the PVR 1726 in this embodiment preferably includes throttle control forcontrolling the maximum rate at which the recorded transport streams areplayed back. In this embodiment, the rate of playback may vary between10 to 81 Mbps with a normal rate of playback of 27 Mbps. Otherembodiments may have different playback rates.

The second method uses a hold mechanism which halts the data output. Thehold mechanism preferably is activated when the video decoder facesimminent overflow conditions. The PVR 1726 preferably receives videopause signals 1,2 1750 as well as an audio pause signal 1752. The videopause signals 1,2 preferably indicate to the PVR 1726 that a videobuffer for video for channel 1 or channel 2, respectively, is gettingtoo full and not ready to receive further input and that the PVR 1726should pause before providing additional video data. The video buffermay also be called a coded data buffer or a compressed data buffer. Thevideo buffer sometimes is also called a video buffer verifier (VBV)buffer or simply a VBV. In one embodiment, there actually are two videobuffers for video for, e.g., PIP display. Thus, video pause signals 1and 2 preferably are provided by the video decoder to pause the twovideo buffers independently of each other. Similarly, the audio pausesignal 1752 preferably is provided by the ADP to the PVR 1726 toindicate that an audio buffer is getting full and is not ready toreceive further input and that the PVR 1726 should pause beforeproviding additional audio data.

In other embodiments, only one of the two methods, namely the throttlecontrol mechanism and the hold mechanism, may be implemented to preventoverflow. In still other embodiments, other methods may be used toprevent overflow in the video and audio buffers.

During the play back mode, the PVR 1726 may playback the packetizedelementary streams (PES) extracted by the PES parser 1718 and stored inthe external memory, i.e., circular memory buffer, rather than thetransport packets. In this case, the PES may not be parsed in theparsers 1706 a-c. The PES stream preferably is provided to the highspeed interface module 1730 to be outputted as the output 1754 and tothe buffers 1 and 2 1732 and 1734 to be outputted as the outputs 1756and 1758, respectively.

XV. Video Transport Processor

Referring back to FIG. 40, the video transport 1602, preferably is anMPEG-2 video transport. The video transport 1602 preferably hascapabilities to extract video elementary streams from PES or transportstreams, detect and handle errors at the transport/PES level of thevideo streams, segment video into rows and creates a start code tablefor use by the video RISC 1604 to pick up video data from an externalmemory. The start code table indicates which video data is at whichexternal memory address. The video transport 1602 stores the start codetable in the external memory.

The video transport 1602 preferably has the following features: acapability for receiving two in-band and one out-of-band MPEG-2Transport streams; a host feed interface for feeding a transport stream;a content addressable memory (CAM) based PID filtering and PSI sectionfiltering; a support for custom message filtering; a PCR recovery andlocal PCR correction with built-in PWM/PDM; CRC checking for PSIsections; a processor-based transport stream parsing; specialinstructions for quick transfer of data to external memory and fordiscarding unwanted packets; and a capability to perform start codealignment and creation of index data structure, i.e., a start codetable, for use by the video RISC 1604.

FIG. 44 is a block diagram of the video transport 1602 in one embodimentof the present invention. The video transport 1602 preferably processesthree simultaneous input channels, two in-band channels and oneout-of-band channel. Thus, the video transport 1602 preferably includesthree front end interfaces 1800 a-c to receive the incoming serialtransport streams. The front end interfaces preferably convert theincoming serial transport streams into parallel, e.g., byte-wise,format.

The video transport 1602 preferably also includes a clock recoverymodule 1820. The clock recovery module 1820 preferably includes a localprogram clock reference (LPCR) logic, and may also function as a pulsewidth modulation (PWM)/pulse duration modulation (PDM) generator and asa watchdog timer. When a program clock reference (PCR) is found in thetransport stream, a PCR PID detect state machine preferably sends astrobe to store the current value of the LPCR into registers.

The watchdog timer is a down counter which preferably counts down fromthe value to which it initialized and generally may interrupt when theterminal count has been reached. The watchdog timer interrupt is used bya transport RISC 1812 to handle any exceptional case list.

The transport RISC 1812 preferably includes a number of components suchas transport RISC core for performing main processing, interruptcontroller for handling interrupts, timers and DMA for transferring datafrom the transport RISC to the external memory, e.g., SDRAM.

Although the video transport 1602 has a capability to process threechannels simultaneously, one to three channels may be processedsimultaneously in practice. In one embodiment of the present invention,the video transport 1602 is capable of receiving either a transportstream or a PES stream from the data transport 1600 as either in-band 1or in-band 2 input. In other embodiments, the video transport 1602 mayreceive either a transport stream or a PES stream, but not both, fromthe data transport 1600. In another embodiment, the source in-band 1 andin-band 2 channels are multiplexed and only one or the other is providedto the video transport as either in-band 1 or in-band 2, but not both.

In one embodiment, the video transport 1602 does not include adescrambler. Thus, if the source in-band transport stream has beenencrypted, the source in-band transport stream preferably isdescrambled, i.e., decrypted, in the data transport 1600 first, and thenprovided to the video transport 1602. The descrambling, also known asdecrypting, may include but not limited to DES and DVB descrambling. Inother embodiments, the video transport 1602 may have a descramblingcapability.

In the embodiment illustrated in FIG. 44, after serial-to-parallelconversion in the front end interfaces, the transport streams preferablyare provided to three quad packet buffers 1802 a-c. In otherembodiments, the transport streams may be provided to other types ofbuffers such as a single buffer per transport stream or a single bufferper all three transport streams. In still other embodiments, the buffersfor receiving the transport streams may not be used.

Each of the quad packet buffers 1802 a-c in FIG. 44 preferably holdsfour transport packets and presents them in turn to subsequentprocessing blocks. The video transport 1602 preferably is also capableof receiving a host feed from, for example, a CPU. The host feed isreceived by a buffer 1804. The buffer 1804 may be a relatively smallbuffer having size of 256 bytes. An arbiter 1806 preferably selects oneof three input transport streams and the host feed, and feeds it to thetransport RISC 1812 in a round robin manner. In one embodiment of thepresent invention, a processing rate of the selected transport packetsis 81 Mbps. In other embodiments, the processing rate may be more orless than 81 Mbps.

In one embodiment of the present invention, each of the quad packetbuffers may store up to 256 bytes. In other embodiments, the number ofbytes each of the quad packet buffers may store may be more or less than256 bytes in length. Further, there may be more or less than four inputbuffers in other embodiments.

The CRC 32 module 1808 preferably includes a CRC 32 check logic forchecking PSI section errors. The CRC-32 module 1808 preferably is usedto check CRC on PSI sections in the transport streams.

The video transport 1602 preferably also includes a data switch 1810 todirect the transport stream from the arbiter 1806 either to thetransport RISC 1812 or to an external memory through a start codealignment module 1816. For the processing of the transport header, thedata switch 1810 preferably directs the incoming transport stream to thetransport RISC 1812. The transport RISC 1812 preferably compares thetransport packet PID with one of the PID's from a PSI/PID contentaddressable memory (CAM) 1814, which preferably has been loaded with thePID's by the transport RISC 1812 (firmware running in the transportRISC) at the start up time.

After the transport header processing, the data switch 1810 preferablydirects the transport stream from the arbiter 1806 to the start codealignment module 1816, which preferably detects start codes. Upondetecting a start code, the start code alignment module preferablyalerts the transport RISC 1812, e.g., by generating an interrupt. Oncealerted, the transport RISC 1812 preferably determines the type of thedetected start code, and preferably processes the incoming videoelementary stream in accordance with the type of the start code. Forexample, if the start code is indicative of a SEQUENCE header, theincoming video elementary stream preferably is provided to an externalmemory, e.g., SDRAM, through the start code alignment module 1816 as anew SEQUENCE.

The start code alignment module 1816 preferably initially transfers thevideo elementary stream into a buffer in a memory control interface1818, which interfaces with the memory controller to access the externalmemory. The buffer in the memory control interface 1818 may be a doublebuffer in one embodiment of the present invention. The video elementarystream is then placed into the external memory. The memory controlinterface 1818 preferably also includes a state machine to interfacewith the memory controller. In one embodiment, the state machinepreferably is hardware based.

In one embodiment, when the start code alignment module 1816 stores theincoming video elementary stream in the external memory, the incomingstream may be stored in Gword format, which is 128 bits in size. Inother embodiments, the incoming stream may be stored in other formats.

The MPEG video decoder in one embodiment includes row decoders (rowRISCs) that decode the video elementary stream (row by row). Startingeach macroblock row at the Gword boundary is important for efficientdecoding, and start of each row preferably starts at the Gword boundary.If there are some bytes, e.g., 8 bytes, left at the end of one row,these 8 bytes are filled with zeros in order to start the nextmacroblock row at the next Gword boundary. The Gword alignment in oneembodiment preferably is switched on/off by the transport RISC.

In order to align macroblock row at the Gword boundary of the SDRAM, thestart code alignment module 1816 in one embodiment preferably performszero stuffing by introducing zero valued bytes and aligning the startcodes to occur on the Gword boundary. The zero stuffing preferablyenables easy partitioning, indexing and subsequent access to chunks ofthe video elementary stream. In other words, the start code alignmentmodule 1816 in one embodiment preferably inserts zero's between the endof one macroblock row and the beginning of the next macroblock row toalign each macroblock row to start at the Gword boundary. This processpreferably permits the video elementary stream to be decodedsimultaneously by multiple decode elements, e.g., row RISCs.

The start code alignment module 1816 preferably also functions as astream manipulator in one embodiment. The stream manipulator preferablyis used to Gword align the start codes in the video elementary stream. AGword is 128 bits in size. The stream manipulator preferably also helpsthe transport RISC to make the index address data structure.

The memory control interface 1818 preferably computes the address withina transfer. In case of a video buffer getting full, the memory interfaceinterrupts the transport RISC and waits until a new address of the videobuffer is provided by the firmware. The sequence of memory controllercommands is decided by the memory interface state machine. At the end ofa memory transfer to the external memory, e.g., SDRAM, a “Memory WriteDone” interrupt is given to the transport RISC 1812 to indicate that thememory transfer has been completed.

For example, a picture for HDTV (1080i format) may have dimensions of1920×1080 pixels. This picture is stored in the external memory, e.g.,SDRAM, as rows of macroblocks. In one embodiment, each macroblock row isindexed in the start code table, row by row, and the start code table isused as an index of how the video data is saved in the external memory.

In one embodiment, layers down to and including SLICE header preferablyare processed in the transport RISC 1812. The transport RISC 1812identifies the SLICE header. For example, SLICE 0 and associated videodata may be identified by the transport RISC 1812. The transport RISC1812 stores the SLICE header and video data into the external memory.Next, the transport RISC 1812 processes SLICE 1, and so forth. This datastored in the external memory preferably is processed by the video RISC1604. The video RISC preferably looks for video data at the addressesindicated in the start code table, and provides the video data to therow RISCs 1606, 1608.

XVI. MPEG Video Decoder for Concurrent Multi-Row Decoding

The system of the present invention preferably is capable of decodingMPEG Main Profile at High Level (MP@HL) and ATSC-specified HDTV videostreams (up to and including 1080i. The system may also decode MPEGstreams that are compatible with other profiles such as main profile atHigh-1440 Level (MP@H14), 4:2:2 Profile at High Level (4:2:2@HL) andHigh Profile at High Level (HP@HL). In one embodiment, the system usesconcurrent multi-row decoding to handle the complex operations. Theconcurrent multi-row decoding allows two or more decode paths to beoperated concurrently.

Referring back to FIG. 40, MPEG video decoding function in oneembodiment is performed by three RISC processors: a video RISC 1604 forprocessing higher layers of MPEG video and row RISCs 1606 and 1608. Inother embodiments, types of processors other than RISC processors and/ordifferent number of processors may be used.

FIG. 45 illustrates MPEG-2 video decoding in one embodiment of thepresent invention. Multiple rows are concurrently decoded in two rowdecode paths 1902A and 1902B. The number of decode paths and theoperation frequency may vary in different embodiments of the presentinvention.

FIG. 45 illustrates details of the first row decode path 1902A only,however, the second row decode path 1902B is substantially identical tothe first row decode path 1902A. All firmware for these RISC processorsis preferably executed from on-chip SRAMs, which are preferably loadedfrom main memory automatically upon initialization of the system. TheMPEG video decoding function is preferably performed by a video RISC1604 and first and second row decode paths 1902A and 1902B. The videoRISC 1604 and row RISCs inside the row decode paths preferably share asimilar architecture. However, each processor preferably is optimizedfor its task, thereby significantly improving efficiency and/or size ofimplementation.

In MPEG-2 video elementary streams, each picture is encoded usingmultiple slices, where a slice is formed from groups of horizontallyneighboring macroblocks. Further, a single row of macroblocks in apicture is typically made up of one or more slices. No slice includesmacroblocks from more than one macroblock row.

The video RISC 1604 preferably receives compressed MPEG video data. Thevideo RISC 1604 preferably parses and processes higher level layers ofcompressed MPEG video data including SEQUENCE, group of pictures (GOP),EXTENSION and PICTURE layers. The SLICEs preferably are provided to therow RISCs for processing of the layers including SLICE, macroblock andblock layers.

The video RISC 1604 includes a video RISC core 1900 and a DMA module1901. The video RISC core 1900 preferably orders the DMA module 1901 totransfer video data from the external memory over a memory interface1932 to the first and second row decode paths 1902A and 1902B. The videodata may also be provided to and consumed by the video RISC core 1900.

FIG. 46 is a block diagram of the video RISC 1604. The video RISC 1604,preferably includes, in addition to the video RISC core 1900 and the DMAmodule 1901, a host CPU bridge 1942, a FIFO 1940, a memory 1934, aninterrupt controller 1936 and peripherals 1938. The peripherals 1938 areused during operation of the video RISC core 1900 and may includesemaphore registers, timers, etc.

The DMA module 1901 transfers video data from the external memory, e.g.,SDRAM over the memory interface 1932 and provides to the first andsecond row decode paths 1902A and 1902B in FIG. 45. The video RISC core1900 is coupled to the host, e.g., CPU, over a CPU interface 1946through the host CPU bridge 1942. For example, the CPU interface 1946may be coupled to the CPU register bus, and the video RISC 1604 may beprogrammed using this bus. This bus may be mastered by the video RISCcore 1900 or by the host, i.e., the CPU. The memory 1934 preferably is adual ported RAM. Access address is provided to the memory 1934 by thevideo RISC core 1900.

The video RISC core accesses the start code table and looks up thelocation (addresses) of video data in the external memory. The videoRISC provides the location to the DMA module 1901 and orders the DMAmodule 1901 to transfer video data from the external memory. The DMAmodule 1901 requests to the memory controller 1634 to obtain the videodata. In one embodiment, the memory controller 1634 preferably reads thevideo data from the external memory and the DMA module transfers thatdata to the memory 1934. In other embodiments, video data from theexternal memory may be transferred directly to FIFOs via the DMA module.

The video RISC core associates the video data in the memory with one ofthe FIFOs in the first and second row decode paths or with the FIFO1940. In one embodiments, there are two FIFOs in each of the first andsecond row decode paths for a total of four FIFOs in the decode paths.The FIFO 1940 is on the same bus as the row decoder FIFOs. Thus, whenthe DMA 1901 transfers the video data out of the memory 1934, each videodata is associated with a FIFO ID. The video data is then read by theFIFO corresponding to the associated FIFO ID. The video RISC core 1900processes the start code table and accordingly distributes the videodata from the external memory to multiple concurrent decode units todifferent FIFOs. The start code table preferably is prepared by thetransport RISC 1812 and stored in the external memory along with thevideo data. The start code table contains the start point and size ofthe video data blocks in the external memory.

If the FIFO ID associated with the video data so indicates, the videoelementary stream comes through the FIFO 1940 into the video RISC core1900. The video RISC core performs SEQUENCE, GOP, EXTENSION and PICTUREheader decoding with the provided video elementary stream. In thedescribed embodiment, row RISCs 1606 and 1608 in the first and secondrow decode paths 1902A and 1902B, respectively, perform SLICE layer,macroblock layer and block layer decoding. In other embodiments of thepresent invention, less layers may be decoded in the video RISC andcorrespondingly more layers may be decoded in the row RISCs or viceversa.

Information decoded by the video RISC core 1900, such as picture sizeand picture structure, are used by the row RISCs during decoding. Thisinformation is also used to generate addresses needed for motioncompensation. These information preferably are passed over the CPUinterface 1946, which may include the register bus. The row RISCs 1606and 1608 are also coupled to the CPU interface 1946, and the generatedaddresses may be provided to the row RISCs over the CPU interface. Someof the parameters that the video RISC core needs for programming mayalso be provided to the video RISC core over the CPU interface.

Concurrent Multi-Row Decoding and Double Headed Row Decoding

When decoding a macroblock row of a video picture, macroblocks (group of16 by 16 pixels) of each slice are typically processed sequentially.There are two distinct sections to each macroblock: the macroblockheader and the block layer data.

The processing of block layer data is often difficult and involves useof several decompression algorithms to focus on that aspect, such asHuffman decoding, inverse quantization, inverse discrete cosinetransform, etc. In addition, parsing and further interpreting the datafrom the macroblock header is not at all trivial, especially in the caseof bi-directionally predicted macroblocks (B-type) and in the case ofdual-prime coded macroblocks. The process of parsing the header,extracting the motion vectors and converting them to memory addressesfor pixel prediction takes significant number of clock cycles, evennotwithstanding hardware acceleration.

Until and unless all the header bits are processed (parsed and stored),the block layer data typically cannot be reached. In other words,processing of the block layer data generally does not start until theheader bits are processed. Thus, the total amount of time used toprocess a macroblock typically includes both the time used to performheader processing and the time used to process the block layer data. Ifone decoder were to perform both these tasks, one behind the other, theblock layer hardware would be forced to remain idle during the headerparsing period, thus wasting precious MIPs and leading tounder-performance.

In one embodiment of the present invention, two macroblock rows ofcompressed video data are provided at a time through two separate FIFOsto both the row RISC and the variable length decoder (VLDEC), also knownas a Huffman decoder. The VLDEC in each row decode path is used tovariable length decode macroblock headers in the two macroblock rows,alternating between the two on a macroblock by macroblock basis. The rowRISCs also have a variable length decoding capability for decoding theblock layer data. Each row RISC, along with the associated motion vectorprocessor, variable length decodes and processes both the rows,alternating between the two on a macroblock by macroblock basis. Inother embodiments, each row RISC may include a motion vector processor.

Accordingly, in one embodiment, each macroblock is variable lengthdecoded by both the VLDEC and the row RISC. The row RISC decodes theSLICE header, macroblock header and directs the block layer data to theVLDEC for variable length decoding. Thus, the VLDEC and the row RISC inone embodiment process alternate macroblocks from different rows formaximum efficiency of memory bandwidth.

Returning now to FIG. 45, in one embodiment, compressed video data fromthe DMA module 1901 is provided to the first row decode path 1902A andthe second row decode path 1902B. Each of the two row RISCs 1606 and1608 may decode any two rows of a given picture simultaneously,alternating between their macroblocks. Therefore, each of the first andsecond row decode paths 1902A and 1902B is provided with two macroblockrows of compressed video data at a time for concurrent decoding.

The first row decode path 1902A includes FIFO 1 1904 and FIFO 2 1906,which are used to receive video data transferred by the DMA 1901. Thefirst row decode path 1902A also includes an extractor 1 1908 coupled tothe FIFO 1 1904 and an extractor 2 1910 coupled to the FIFO 2 1906. Theextractors 1 and 2 are used to extracts video data bits for decodingfrom the FIFOs 1 and 2, respectively.

The first row decode path 1902A also includes a switch 1912. The switch1912 is used to direct incoming video data either to a VLDEC 1914 or tothe row RISC 1 1606. The switch 1912 provides the SLICE header and thenthe macroblock header of a macroblock to the RISC 1 1606 for decoding;then the switch 1912 provides the block layer data of the samemacroblock to the VLDEC 1914 for decoding. As the switch 1912 providesthe block layer data of the same macroblock to the VLDEC 1914, itprovides the macroblock header of the next macroblock in the othermacroblock row to the RISC 1 1606 for decoding, and so on. Therefore,multiple macroblock rows are decoded at the same time in each row decodepath. Outputs of the row RISC 1 1604 and the VLDEC 1914 are multiplexedin a multiplexer 1916 and provided to a FIFO 1918, which in turnprovides them to an inverse quantizer (IQTZ) module 1920.

FIG. 47 is a context flow graph showing in more detail the operation ofone of the two row decode paths. Each of the two row decode paths isused to decode two macroblock rows concurrently. Each macroblock is madeup of a macroblock header and a macroblock content, i.e., block layerdata. Macroblock rows 1 and 2 are associated with contexts 0 and 1, andare multiplexed together and provided to the row RISCs and the VLDECs.

The context flow graph depicts how the data flow and control alternatesbetween the two contexts of the row RISC (for macroblock header decode)and the two contexts of the VLDEC (for the block layer data decode). Thedecoded information from each thread is combined back into a common datastream for further processing by the inverse quantizer and otherdownstream modules.

First, the row RISC is associated with the context 0, a macroblock row 1is provided to the row RISC, and the row RISC decodes the header ofmacroblock 1 of row 1 in step 1931. Meanwhile, the VLDEC, associatedwith context 1, waits for the row RISC to complete decoding of theheader in the row RISC and the block data of macroblock 1 of row 1 to beprovided for block data decoding.

When the row RISC completes decoding of the macroblock header, thecontext for the row RISC switches as indicated by vector 1947 a to thecontext 1. Similarly, the context for the VLDEC switches as indicated bypointer 1949 a. Thus, the block data of macroblock 1 of the row 1 is nowprovided to the VLDEC as indicated by pointer 1951 a. As the VLDECdecodes the block data of macroblock 1 of row 1 in step 1939, the rowRISC decodes a macroblock header for macroblock 1 of row 2 in step 1935.

Afterwards, the contexts switch again as indicated in pointers 1947 band 1949 b, and the macroblock row 1 is provided to the row RISC whilethe macroblock row 2 is provided to the VLDEC. Thus, block data ofmacroblock 1 of row 2 is now provided to the VLDEC for decoding asindicated in pointer 1951 b, and the VLDEC decodes the block data ofmacroblock 1 of row 2 in step 1945. Meanwhile, the row RISC decodes amacroblock header of row 1, macroblock 2 in step 1933.

After the row RISC and the VLDEC finish respective decoding, thecontexts switch once again as indicated by pointers 1947 c and 1949 c,so that the row RISC receives the macroblock row 2 while the VLDECreceives the macroblock row 1. The block data of macroblock 2 of row 1is now provided to the VLDEC for decoding as indicated in pointer 1951c, and the VLDEC decodes the block data of macroblock 2 of row 1 in step1941. Meanwhile, the row RISC decodes a macroblock header of row 2,macroblock 2 in step 1937.

The decoding of the macroblocks by the row RISC and the VLDEC continuesuntil all macroblocks of both rows are decoded. Once all the macroblocksof both the rows are decoded, a new pair of rows from the same or thenext picture is fed to the row RISC and the VLDEC. More than one rowdecode paths may be deployed in parallel, to further double or triplethe decode performance. This permits a linearly scalable architecture.

Returning now to FIG. 45, the downstream blocks (IQTZ module 1920, IDCTmodule 1922, pixel reconstruction module 1930) in the row decode pathwork alternately on macroblocks from two different rows (slices). Thus,some of the information which varies across two different slices of thesame decoded picture, such as quantizer scale factor (quantizer scalecode) and the DC history values of the luminance and the chrominancepictures are maintained as two contexts.

The motion vector processor 1926 is a co-processor coupled to the rowRISC through the processor bus. It serves to accelerate the conversionof motion vectors into the memory address pointers. The motion vectorprocessor 1926 preferably communicates its results to the video rowmanager 1928, which coordinates memory accesses and the pixelreconstruction module 1930.

XVII. Providing HDTV Video and SDTV Video of the Same Video ImagesSimultaneously

Currently the majority of households own video cassette recorders (VCRs)that are compatible with standard definition television (SDTV) withformats such as NTSC, PAL and SECAM. The SDTV-compatible VCRs typicallyare incapable of recording a high definition television (HDTV) video.Therefore, while a viewer watches the HDTV video, it may be desirable tohave access to the same video program material for recording using anexisting SDTV-compatible VCR.

In another embodiment, the SDTV output may have different graphics fromthe HDTV output. For example, graphics such as subtitles andclosed-caption information may be included in the SDTV output and not inthe HDTV output, or vice versa. SDTV graphics may be in a differentformat in order to obtain suitable quality when recorded on an SDTV VCR.Also, the picture-in-picture (PIP) secondary video picture that may bepresent on the HDTV display may or may not be recorded on the VCR. Itmay be advantageous not to record the PIP video.

In one embodiment of the present invention, an HDTV video, while beingdisplayed on an HDTV-compatible display, is scaled down to an SDTV videoand provided as an output to be recorded using an SDTV-compatible VCR.Since both the HDTV video and the SDTV video are provided, the viewer isallowed to view the HDTV video while recording the SDTV video of thesame video images using an SDTV-compatible VCR. The SDTV video may beprovided with or without graphics such that the VCR recording may or maynot record the graphics along with the video. For example, it may bedesirable to record the graphics if the graphics include subtitles for aforeign movie. For another example, it may be desirable to record theSDTV video without the graphics if the graphics include such informationas program guide or a graphics window alerting receipt of an e-mail.

FIG. 48 is a block diagram that illustrates one embodiment of thepresent invention where an HDTV video is provided as an SDTV videooutput while being displayed on a high definition (HD) display 2006. TheHD display 2006, for example, may be an HDTV monitor. An HD displayfeeder 2000 preferably provides an HDTV video to an HD scaler 2002. TheHDTV video may be in one of many HDTV formats such as an interlaced1080i format, a progressive 720p format or any other HDTV format. TheHDTV scaler 2002 preferably converts the format of the HDTV video toanother HDTV format, such as from the 1080i format to the 720p format orvice versa, or from any HDTV format to any other HDTV format. The HDTVscaler 2002 may also scale an SDTV video up to an HDTV video.

The HDTV video is then provided to a graphics compositer 2004 to beblended with graphics. The HDTV video is also provided to a multiplexer2008. After blending the HDTV video with graphics, the graphicscompositor outputs the blended HDTV video both to an HD display 2006 tobe displayed and to the multiplexer 2008. Since both the HDTV video andthe blended (with graphics) HDTV video are provided to the multiplexer2008, either the HDTV video or the blended HDTV video with graphics maybe provided to a scaler 2010 to be scaled into an SDTV format andcaptured into a memory 2012. The SDTV format may include NTSC, PAL,SECAM formats, or any other conventional or non-conventional SDTVformat.

The SDTV video stored in the memory 2012 preferably is read into adisplay video window 2014 and provided as the SDTV video output forrecording using an SDTV-compatible VCR. An HDTV video is typicallydisplayed at 60 frames or fields per second while, for example, anNTSC-standard SDTV video is typically displayed at 59.94 fields persecond. The display rate may be converted from 60 frames or fields persecond to 59.94 fields per second when the HDTV video is converted tothe NTSC-standard SDTV video.

In some application scenarios such as those where the HDTV content has arate of 60.0 frames or fields per second, and the SDTV output has a rateof 59.94 fields per second, the SDTV video that is captured to memorypreferably is stored into and displayed from dual memory buffers. In oneembodiment of the present invention, the system preferably includes thecontrols and mechanisms to manage the dual memory buffers. Thesecontrols may be implemented in software, hardware, or a combination.Double-buffered video and graphics are well understood by those withskill in the art of animated graphics and digital video.

XVIII. Downscaling during Video Decoding to Reduce Memory Size andBandwidth

Currently the majority of households own standard definition television(SDTV). In order for them to watch the content of high definition (HD)signals on SDTV, the system should perform HD to SD conversion. Inaddition, downscaling of HDTV images is often desirable to save memoryspace and memory bandwidth even when HDTV is used for display. In oneembodiment of the present invention, downscaling during the videodecoding process is implemented. The described embodiment of the presentinvention reduces the system cost while maintaining image quality.

There are two common conversion methods:

a) In the first conversion method, full images are reconstructed andstored in external memory (SDRAM). Downscaling is performed duringdisplay time.

b) In the second conversion method, downscaling is typically performedduring decoding time. The images are downscaled both horizontally andvertically during reconstruction (pixel prediction & motioncompensation). Thus, quarter sized images are reconstructed and storedin external memory.

The first conversion method typically keeps image quality but itconsumes significant memory space and memory bandwidth. The secondconversion method typically saves memory and memory bandwidth, but usingthis method generally results in a significant loss of image quality. Ifimages are downscaled vertically during reconstruction, image quality isgenerally lost because of the use of two major classifications ofprediction mode, frame prediction and field prediction, in MPEG-2.

In addition to the two major classifications of prediction mode, MPEG-2uses two major classifications of the picture structure: frame pictureand field picture. Thus, each frame may be a single coded frame-pictureor two coded field-pictures (one is a top field picture, and the otherone is a bottom field picture). FIGS. 51-57 illustrate different fieldand frame prediction modes using frames pictures and field pictures.

For example, if all pictures were frame coded or all pictures were fieldcoded, use of vertical downscaling typically would not result in asignificant loss of quality. However, MPEG-2 standard supportsinterlaced video with a variety of coding modes, such that the alternate(even and odd) sets of lines within a macroblock in MPEG-2 may representdifferent field time in the video stream, and both even and odd lines,that is both fields, may be needed for predicting subsequent pictures.If the video were downscaled vertically during decoding, criticallyimportant information that distinguishes between the two fields may belost.

FIG. 49 is a block diagram of MPEG video decoding stages 2100 in oneembodiment of the present invention. In this embodiment, downscaling ofimages is not performed.

FIG. 50 is a block diagram of MPEG video decoding stages 2102 in anotherembodiment of the present invention. The MPEG video decoding stages inFIG. 50 preferably operate in reduced memory mode (RMM) with two maingoals of reducing required memory bandwidth and reducing required memoryspace. In addition to the MPEG video decoding stages in FIG. 49,horizontal downscaling is performed in a downscale filtering stage 2124after reconstruction in a reconstruction stage 2110. The downscaledvalue preferably is written into the external memory as a reconstructedframe 2120. At the time of prediction, a horizontal upscaling preferablyis performed at a scale up filtering stage 2122 after reading thedownscaled values, i.e., a forward frame 2116 and a backward frame 2118,from the external memory. The upscaled value preferably is provided to apixel prediction stage 2114.

If vertical downscaling is performed during reconstruction, accumulatederrors generally are increased significantly due to the loss of rowinformation. That is the reason why images are downscaled by half onlyin the horizontal direction, and not in the vertical direction, in theembodiment illustrated in FIG. 50. Thus, the accumulated errors and lossof information preferably are lessened.

The embodiment of the present invention illustrated in FIG. 50preferably maintains good image quality while, at the same time,reducing the required memory space and memory bandwidth. This embodimentmay be used during conversion of HD to SD output format. The conversionalgorithm in this embodiment may also be applied to HD-to-HD conversionapplications in order to reduce memory bandwidth and memory spacerequirements, so that extra memory bandwidth and memory space may beused for other applications (CPU or high-end graphic applications,etc.).

Therefore, a key point of the embodiment illustrated in FIG. 50 is thatduring the reconstruction stage, images are reduced by half only inhorizontal direction, and not in vertical direction. Thus, accumulationof errors and loss of information are lessened when compared with thecase where the images are reduced by half in both horizontal andvertical direction. Vertical scaling and further horizontal scaling maybe performed in the display engine. In other embodiments, the images maybe scaled up or down both horizontally and vertically.

The downscale filter preferably is performing the following functions:

For (y = 0; y < row; y++) {   If (downscale) {     For (x = 0; x <column; x += 2) {       pel_sd[y][x  >> 1] = (pel[y][x] +pel[y][x+1])/2;     }   }   else {     For (x = 0; x < column; x++) {        pel_sd[y][x] = pel[y][x];     } }where pel[ ][ ] preferably is the output of the final reconstructionstage 2110 for the luminance and chrominance (U/V) blocks. pel_sd[ ][ ]preferably is the downscaled value which is written into the externalframe buffers.

Since predictions preferably are formed by reading prediction samplesfrom the reference frame buffers, a given sample typically is predictedby reading the corresponding sample in the reference frame buffer offsetby the motion vectors. Therefore, the motion vectors preferably are alsomodified depending on whether downscaling is performed or not.

MVx: The horizontal motion vectors preferably receive from the MotionVector reconstruction stage 2112 refer to the luminance component.

Full_pel: The decoded motion vector values preferably represent integerpel offsets (rather than half pel units). In MPEG2, the decoded motionvectors values typically represent half pel units.

Downscale: When high, it preferably indicates that the scale downfunction is enabled. When low, it preferably indicates that the scaledown function is disabled and the pixel prediction will perform thenormal operation without scaling.

If (Downscale) {   If (luminance) {     MVx = MVx >> 2;      }   else  {    MVx = MVx/2) >> 2;     }       } else   If (luminance) {     MVx =MVx >> 1;     }   else {     MVx = (MVx/2) >> 1;     }   }The upscale filter preferably performs the following functions:

For (y = 0; y< row; y ++) { If (downscale) {     For (x = 0; x < column;x++) {       pel_us[y][2*x] = pel_ref[y][x];       pel_us[y] [2*x+1] =pel_ref[y] [x];   }   }   else {   For (x = 0; x < column; x++) {    pel_us[y][x] = pel_ref[y][x];   }   }where pel_us[ ][ ] is the upscale sample being formed and pel_ref[ ][ ]are samples in the reference frame buffers.

In yet another embodiment of the present invention, downscaling ofimages during decoding is disabled when the coded video does not containB pictures. In the common practice of MPEG video decoding, particularlywhen following the ATSC (Advanced Television Systems Committee)recommendations, when there are no B pictures, there may be a relativelylong string of P pictures, such that prediction error accumulation maybe serious. However, when there are no B pictures, the worst case memorybandwidth required for decoding is reduced by approximately half,thereby achieving one main goal of the reduced memory mode (RMM) (exceptwhen the encoded video stream uses “dual prime” mode). Further, whenthere are no B pictures, the maximum memory space required typically isalso reduced, thereby making it possible to achieve the other main goalof RMM without any downscaling.

With RMM downscaling turned off, there is no prediction erroraccumulation, which may also be referred to as “drift”. So, simplydetecting the lack of B pictures and turning off RMM downscalingprovides a great improvement when decoding stream with no B pictures. Onthe other hand, when there are B pictures in the stream, there generallyare not long strings of predicted (P) pictures without intervening Ipictures, so RMM method may be used without incurring significantprediction error accumulation, again enabling savings in memory spaceand bandwidth while retaining good quality.

The odd case is when the stream uses “dual prime”. Fortunately, this israrely if ever used in HDTV encoding or modern SDTV encoding. If andwhen the “dual prime” is used, RMM downscaling may be left on, riskingsome loss of quality in some cases, but it still works, or RMMdownscaling may be turned off, resulting in normal full decoding, noloss of quality, possible savings in memory space, and no savings inmemory bandwidth with worst case streams.

XIX. MPEG Specific Data Transfer Commands

Reading SDRAM for MPEG video decoding can be very inefficient, andefficiency in this operation typically is very important to creatingcost effective products that perform properly in various differentcases. Normal protocols between memory controllers and their clients,e.g., CPUs or other processing devices use conventional addressing andread/write schemes, such as “read N bytes starting at address A.” Thistypically is inefficient for MPEG video decoding.

In one embodiment of the present invention, the MPEG video decoderpreferably indicates to the memory controller exactly what type ofaddressing pattern is needed to return the data that is requested by theMPEG video decoder, using a special protocol that preferably isoptimized for this purpose. The memory controller preferably uses theserequest types to perform memory address reads that preferably areoptimized in terms of efficiency and performance, to read from thememory and return to the MPEG video decoder exactly the data that wererequested while preferably using the minimum possible number of memoryclock cycles, and also preferably minimizing the number of clock cyclesused on the bus that couples the MPEG video decoder to the memorycontroller.

In one embodiment of the present invention, video data is stored in amanner suitable for building video images, performing reference(prediction) reads, and performing raster scan reads, all in anefficient manner. The luminance data is stored separately from thechrominance data. For example, FIG. 58 is an image block diagram 2250 ofimage organization of luminance macroblocks. The video image isorganized into four banks b0-b3 of 64 bit SDRAM in the describedembodiment. Other embodiments may use other memory types with, e.g.,different data bus width and/or different number of banks.

Each of the memory locations M₀ to M_(2f) includes luma components forone macroblock, i.e., 16×16 pixels. Since the luma component of eachpixel is represented by 8 bits, luma components of each macroblock is128 bits by 16 in size. One pixel row of component macroblock, e.g.,four luma blocks of a macroblock, is packed into one logical 128-bitword (Gword). Two successive physical 64-bit memory locations in theSDRAM are used to store a 128-bit Gword. For example, the componentmacroblock M₀ includes 16 rows with 128 bits in each row. Each row with128 bits, i.e., Gword, is stored in two successive memory locations ofthe bank b₀.

For chroma, U and V component blocks associated with a macroblock, eachblock has a size of 8×8. Thus, each row in a chroma block has 64 bits.Since the U and V component blocks are typically used side by side, eachrow of the combined U and V component blocks has a size of 128 bits, aGword.

Referring back to FIG. 58, four horizontally neighboring componentmacroblocks are packed into an SDRAM row of a given bank. Consecutivequad-component macroblock sets are packed in incrementing bank numbers.In one embodiment of the present invention, up to four banks per row arepacked. In another embodiment, up to two banks per row are packed. Inother embodiments, different number of banks may be packed per row. Forexample, in the macroblock row 1 2252, the bank b0 includes componentmacroblocks M₀, M₁, M₂ and M₃, the bank b1 includes componentmacroblocks M₄, M₅, M₆ and M₇, the bank b2 includes componentmacroblocks M₈, M₉, M_(a) and M_(b), and the bank b3 includes componentmacroblocks M_(c), M_(d), M_(e) and M_(f).

Only 16 macroblocks are depicted in each of macroblock rows 2252, 2254and 2256 for illustrative purposes. The number of macroblocks in eachmacroblock row typically depends on image resolution and may be more orless than 16. Thus, N macroblocks of a horizontal strip of a video imagemay be arranged in this manner. Consecutive horizontal strips of thevideo image are typically arranged in consecutive locations until allthe image space is allocated. Knowledge of horizontal image size, inmacroblock units, is utilized to intelligently locate verticallyneighboring macroblock pairs.

MPEG Smart SDRAM Control Sequencer

Memory controllers for controlling SDRAM typically are quite simplisticin nature, due to a simple memory organization and a small set of dataaccess types.

SDRAM is generally organized as rows of words. Each row in SDRAM istypically made up of two or four banks with up to 256 columns per bankrow. Row Address (RAS) select operation preferably prepares a bank rowfor access. Column Address Select (CAS) operation preferably accesses aparticular column within the row.

For an MPEG decode application, especially at HD resolution, moreefficient organization of video data enhances accessibility andthroughput. In one embodiment of the present invention, however, acomplex memory organization and a vast set of access types are definedto ensure that the most frequent (thus demanding more bandwidth) requesttypes are serviced very efficiently (more data for a given number ofclock spent in the access). Thus in the described embodiment, a complexmemory controller with capability to access data as suitable for MPEGdecode operation is used.

The memory controller in the described embodiment has an “MPEG Smart”implementation, with 128 different types of read and write burstaccesses. In other embodiments, the number of read and write burstaccess types may be more or less than 128. The memory controller, whenimplementing some (such as: video image prediction reads) of these burstaccesses, makes intelligent decisions on the choice of which particularrow (addresses) for which particular banks need to be prepared with RASoperations, so as to minimize the wasted clocks and achieve the maximumburst efficiency. Further, the memory controller in the describedembodiment is designed to work efficiently, by tailoring the sequencedifferently in each case, for different sizes of stored video images,different types of SDRAM organization, resulting in different modes ofoperation, and different peculiar starting addresses for accesses.

Bus Interface with MPEG Specific Commands

For display purposes, pixels preferably are stored and read in rasterscan order. However, for decoding, accessing pixels in raster scan ordertypically does not result in an efficient memory transfer. Since imageorganization in memory is macroblock oriented in the describedembodiment, the data that is fetched for decoding is not linear data;rather, macroblock data is fetched. For example, a pixel immediatelybelow the current pixel may be the next pixel to be fetched. For anotherexample, alternate lines of particular component macroblock may befetched during field prediction, since each picture is stored in memoryin frame format.

Because of these variations, in order to fetch the macroblock data, theexternal memory is addressed in a particular fashion. Table 5.1illustrates a list of different types of memory accesses that have beendefined in one embodiment of the present invention, In otherembodiments, memory access types and number of different memory accesstypes may be different from those defined in table 5.1.

TABLE 5.1 Request Count/Offset/ Type Type Request D7 D6 D5 D4 D3 D2 D1D0 Description Type Code ‘b0000 Linear Gwords Read Access 0 0 0 0 16Gwords LG_16R 0 0 0 1 1 Gword LG_1R 0 0 1 0 2 Gwords LG_2R n n n n NGwords LG_NR 1 1 1 1 15 Gwords LG_15R ‘b0001 Linear Gwords Write Access(DQM = 0) 0 0 0 0 16 Gwords LG_16R 0 0 0 1 1 Gword LG_1R 0 0 1 0 2Gwords LG_2R n n n n N Gwords LG_NR 1 1 1 1 15 Gwords LG_15R ‘b0010Gword Lower Write Access 0 0 0 0 Write Byte #0 only GL_0W 0 0 0 1 WriteByte #1 to Byte #0 GL_1W 0 0 1 0 Write Byte #2 to Byte #0 GL_2W n n n nWrite Byte #N to Byte #0 GL_NW 1 1 1 1 Write Byte #15 to Byte #0 GL_15W‘b0011 Gword Upper Write Access 0 0 0 0 Write Byte #15 to Byte #0 GU_0W0 0 0 1 Write Byte #15 to Byte #1 GU_1W 0 0 1 0 Write Byte #15 to Byte#2 GU_2W n n n n Write Byte #15 to Byte #N GU_NW 1 1 1 1 Write Byte #15only GU_15W ′b0100 Single Byte Write Access 0 0 0 0 Write Byte #0 SB_0W0 0 0 1 Write Byte #1 SB_1W 0 0 1 0 Write Byte #2 SB_2W n n n n WriteByte #N SB_NW 1 1 1 1 Write Byte #15 SB_15W ′b0101 Single Word WriteAccess 0 0 0 0 Write 16 bit word #0 SW_0W 0 0 0 1 Write 16 bit word #1SW_1W 0 n n n Write 16 bit word #N SW_NW 0 1 1 1 Write 16 bit word #7SW_7W 1 x 0 0 Write 32 bit word #0 SD_0W 1 x 0 1 Write 32 bit word #1SD_1W 1 0 1 0 Write 32 bit word #2 SD_2W 1 0 1 1 Write 32 bit word #3SD_3W 1 1 0 0 8 Gwords Display Write 1 1 0 1 Reserved 1 1 1 0 RefreshCommand 1 1 1 1 Mode Register Set Command ′b1001 Linear Graphics Writes(with client driven DQM Mask) 0 0 0 0 16 Gwords LG_16WG 0 0 0 1 1 GwordLG_1WG 0 0 1 0 2 Gwords LG_2WG n n n n N Gwords LG_NWG 1 1 1 1 15 GwordsLG_15WG ′b0110 Display Read Access 0 0 0 0 16 Gwords (256 pel component)DS_16R 0 0 0 1 1 Gword (16 pel component) DS_1R 0 0 1 0 2 Gwords (32 pelcomponent) DS_2R n n n n N Gwords (N × 16 pel component) DS_NR 1 1 1 115 Gwords (240 pel component) DS_15R ′b1111 Down Conversion MacroblockPrediction (Pred) and Write Access 0 0 0 0 8 Cols, 8 Rows Pred AlternateReads M8×8AR 0 0 0 1 8 Cols, 9 Rows Pred Alternate Reads M8×9AR 0 1 0 08 Cols, 4 Rows Pred Alternate Reads M8×5AR 0 1 0 1 8 Cols, 5 Rows PredAlternate Reads M8×5AR 1 0 0 0 8 Cols, 8 Rows Pred Continuous ReadsM8×8CR 1 0 0 1 8 Cols, 9 Rows Pred Continuous Reads M8×9CR 1 1 0 0 8Cols, 8 Rows Alternate Writes M8×8AW 1 1 0 1 8 Cols, 16 Rows AlternateWrites M8×16AW 1 1 1 0 8 Cols, 8 Rows Continuous Writes M8×8CW 1 1 1 1 8Cols, 16 Rows Continuous Writes M8×16CW ′b0111 Macroblock Prediction(Pred) and Write Access 0 0 0 0 16 Cols, 8 Rows Pred Alternate ReadsM16×8AR 0 0 0 1 16 Cols, 9 Rows Pred Alternate Reads M16×9AR 0 0 1 0 32Cols, 8 Rows Pred Alternate Reads M32×8AR 0 0 1 1 32 Cols, 9 Rows PredAlternate Reads M32×9AR 0 1 0 0 16 Cols, 4 Rows Pred Alternate ReadsM16×4AR 0 1 0 1 16 Cols, 5 Rows Pred Alternate Reads M16×5AR 0 1 1 0 32Cols, 4 Rows Pred Alternate Reads M32×4AR 0 1 1 1 32 Cols, 5 Rows PredAlternate Reads M32×5AR 1 0 0 0 16 Cols, 8 Rows Pred Cont. Reads M16×8CR1 0 0 1 16 Cols, 9 Rows Pred Cont. Reads M16×9CR 1 0 1 0 32 Cols, 8 RowsPred Cont. Reads M32×8CR 1 0 1 1 32 Cols, 9 Rows Pred Cont. ReadsM32×9CR 1 1 0 0 16 Cols, 8 Rows Alternate Writes M16×8AW 1 1 0 1 16Cols, 16 Rows Alternate Writes M16×16AW 1 1 1 0 16 Cols, 8 RowsContinuous Writes M16×8CW 1 1 1 1 16 Cols, 16 Rows Continuous WritesM16×16CW

During “linear Gwords read access” operations, as indicated in table 5.1with a request type of ‘b0000, one to 16 Gwords (128 bits) preferablyare read from memory at a time. During “linear Gwords write access”operations with a request type of 'b0001, one to 16 Gwords preferablyare written to memory at a time.

During “Gword lower write access” and “Gword upper write access”operations with a request type of 'b0010 and a request type of 'b0011,respectively, one to 16 bytes preferably are written to memory at atime. During “single byte write access” operations with a request typeof 'b0100, a byte preferably is written at a time. During “single wordwrite access” operations with a request type of 'b0101, a wordpreferably is written at a time.

During “display read access” operations with a request type of 'b0110,one to 16 Gwords may be read at a time in a raster scan order fordisplay. The Gwords in memory are not stored in the raster scan order.Thus, during the display read accesses, Gwords preferably are notaccessed in a linear fashion.

Various different access types are defined for “down conversionmacroblock prediction and write access” operations with a request typeof 'b1111. During the reduced memory mode, 50% down conversionpreferably is performed in horizontal direction only. Thus, each downconverted macroblock is 8×16 in size. Therefore, for example, during“down conversion macroblock write access” operations, 128 pixelspreferably are accessed during each memory burst access. During readaccesses for field prediction, four or eight alternate macroblock rowspreferably are read at a time. When half pixel resolution is desired,five or nine alternate macroblock rows preferably are read at a time.

During read accesses for frame prediction, eight continuous macroblockrows are read for normal resolution, and nine continuous macroblock rowsare read for half pixel resolution.

During field mode write operations, eight or sixteen macroblock rowspreferably are accessed for alternate writing. During frame mode writeoperations, eight or sixteen macroblock rows preferably are accessed forcontinuous writing.

Various different access types are defined for “macroblock predictionand write access” operations with a request type of 'b0111. For example,since each macroblock is 16×16 in size, 256 pixels preferably areaccessed during each memory burst access for write in one embodiment ofthe present invention.

During read accesses for field prediction in normal resolution mode,four or eight macroblock rows preferably are accessed for alternatereading. During read accesses for field prediction in half pixelresolution mode, five or nine macroblock rows preferably are accessedfor alternate reading. During read accesses in frame prediction, eightmacroblock rows preferably are accessed for continuous writing in normalresolution mode, and nine macroblock rows preferably are accessed forcontinuous writing in half pixel resolution mode.

XX. Audio Decode Processor (ADP) with an Internal Audio Transport

Referring back to FIG. 40, the ADP 1614 performs audio transport andaudio processing functions.

FIG. 59 is a block diagram of the ADP 1614 in one embodiment of thepresent invention. The ADP 1614 includes an audio transport processor2272, an audio FIFO 2270, an audio interface module 2274 and an AC-3 andMPEG audio decompression processor 2276.

The ADP 1614 receives a transport stream containing audio data. In oneembodiment of the present invention, the transport stream has been DESor DVB descrambled in the data transport 1600. In other embodiments, theADP 1614 may perform DES and DVB descrambling.

The audio transport processor 2272 receives the transport stream andprocesses it. The audio transport processor 2272 is responsible forprocessing the transport header, PES header and data for the audiopackets. The audio transport processor 2272 also handles splicing ofaudio services for functions such as commercial insertion. The audiotransport processor 2272 preferably also detects, reports and recoversfrom transport layer errors.

The audio interface module 2274 is responsible for detection andtracking of Dolby AC-3 and Musicam (Masking pattern Universal Sub-bandIntegrated Coding And Multiplexing) audio sync frames. The audiointerface module 2274 contains a state machine that synchronizes audiodelivery to the AC-3 and MPEG audio decompression processor 2276 or anexternal audio processor using PTS and PCR.

The audio interface module 2274 preferably detects and processes variousaudio frame errors. These errors preferably are reported to the host,i.e., CPU, via an interrupt or a register. The audio interface module2274 may maintain the audio FIFO 2270 in an external memory, e.g.,SDRAM. The audio interface module preferably formats the compressedaudio data from parallel to serial format and delivers the serializedaudio data to the AC-3 and MPEG audio decompression processor 2276,which is also called.

The AC-3 and MPEG audio decompression processor 2276 provides a decodedaudio 2278. The audio processor 2276 is capable of decoding Dolby AC-3(audio code number 3) and MPEG bit streams. The audio processor 2276receives serialized compressed frequency domain samples and controlinformation from the transport demultiplexer and outputs a serialde-compressed audio stream as the decoded audio 2278. The audioprocessor 2276 may process a 5.1 channel (5 independent full-bandwidthaudio channels plus a low-frequency sub-woofer channel) Dolby AC-3input. The 5.1 inputs preferably are mixed down to two-output channelscompatible with Dolby Surround equipment. For MPEG-1 and MPEG-2 audiodecoding, the audio processor 2278 preferably decodes only layer 1 andlayer 2 with basic two-channel audio.

The audio processor 2276 preferably contains its own clock generation,input synchronization, error checking, and demultiplexing circuits. Theaudio processor 2276 preferably also includes five modules that carryout the decoding process: a sync and demux unit, a sample expansionunit, a coefficient denormalization unit, an inverse transform unit, andan output processing unit. The sync and demux unit preferably isresponsible for frame synchronization, bsi decoding and CRC checking.The sample expansion unit preferably forms the frequency domain floatingpoint coefficients from the demultiplexed data.

The coefficient denormalization unit preferably scales and normalizesfrequency coefficient and converts frequency domain floating pointcoefficients to fixed point coefficients. The inverse transform unitpreferably processes the frequency domain coefficients back into timedomain samples and writes them into the output processing unit afterperforming down mix and block switch convolution. The output processingunit preferably buffers time domain samples and outputs them based on aninternally generated time reference.

In addition, the audio processor 2276 may also include a digital audioport which may be used to buffer either IEC 60958 or IEC 61937 formatteddata or AC-3 compressed data for use by an external audio processor viaan SPDIF port. The digital audio port preferably supports simultaneousoutput of compressed AC-3 on SPDIF and decompressed AC-3 on the pulsedensity outputs.

The ADP 1614 may also include a 3-D audio engine. (not shown) The 3-Daudio engine preferably interfaces to the serial output of the audioprocessor 2276 and performs 3-D audio enhancement signal processing,conforming to the SRS Labs, Inc., TruSurround and SRS algorithms. The3-D audio engine preferably performs all of its signal processing in thedigital domain, and it preferably acts as a co-processor in a digitalaudio subsystem. The 3-D audio engine may be bypassed, undermicroprocessor control, for applications not requiring 3-D audio.

The ADP 1614 may also include an audio sigma-delta modulator. (notshown) The audio sigma-delta modulator preferably interfaces to theserial output of the 3-D audio engine and performs all functionsnecessary to produce an analog output signal. The output of the audiosigma-delta modulator preferably is a pair of differential pulse densityoutputs for left and right channels. These signals may be low-passfiltered externally to recover the audio signal.

XXI. Integrated System Bridge Controller

A central processing unit (CPU) typically does not have a capability todirectly interface with various different peripheral devices. Thus, theCPU typically uses support devices, e.g., other semiconductor chips, toprovide capability for communicating with peripheral devices. The CPUordinarily uses a bridge controller, e.g., a “north bridge”, tointerface with one or more peripheral devices. Use of the bridgecontroller increases number of chips in the system and introducesanother potential source of system failure.

The system preferably includes a system bridge controller used to couplea CPU to peripheral devices. The system bridge controller preferablysupports a full complement of devices used in a set top box or digitalTV. The system bridge controller preferably is compatible with the 68000bus definition, including both active DSACK and passive DSACK (ROM/flashmemory devices). The system bridge controller preferably supportsexternal bus masters and retry operations as both master and slave.

The system bridge controller preferably provides very high-performanceaccess and data transfers between I/O devices, the PCI bus, systemmemory, e.g., SDRAM, controlled by the memory controller, and the CPU.The system bridge controller may also include one or more ISO 7816 smartcard interfaces 1678 for e-commerce and conditional access system use.

FIG. 60 is a block diagram of a system bridge controller 1648 in oneembodiment of the present invention. In the described embodiment, thesystem bridge controller 1648 provides a “north bridge” function to ahost, e.g., CPU 2404. The system bridge controller in the describedembodiment is comprised of a PCI (Peripheral Component Interconnect)bridge 1642, an I/O bus bridge with DMA 1644 and a CPU interface block1646. The PCI bridge 1642, the I/O bus bridge with DMA 1644 and the CPUinterface block 1646 preferably are coupled together on a CPU-bus 2406.The CPU bus 2406 may include a CPU register bus.

The PCI bridge 1642 is used to control various PCI devices. The PCIbridge 1642 preferably provides a bridge function between the PCIdevices 2400 and the CPU through a PCI interface 1656. The PCI bridge1642 may also provide a DMA function between PCI devices and externalmemory, such as SDRAM. The PCI bridge 1642 preferably is capable ofproviding interface to multiple PCI devices. The PCI interfacepreferably is compatible with 3.3V PCI devices.

Capabilities of the PCI bus interface in one embodiment of the presentinvention include:

a) two external PCI master support;

b) relocatable PCI I/O and memory spaces;

c) PCI interrupt support;

d) two level write buffering from both the CPU and PCI sides;

e) optional read before write transaction ordering;

f) optional big-endian to little-endian conversion;

g) delayed read completion support from PCI to memory; and

h) data phases burst support from PCI to memory.

The I/O bus bridge with DMA 1644 is used to interface with I/O devices2402 such as ROM, RAM, Flash, and a variety of 68000-compatibleperipheral devices through an I/O interface 1658. The I/O interface 1658is a 68000 style bus.

The I/O bus bridge with DMA 1644 preferably has a direct bridge functionto support CPU to I/O communications. The I/O bus bridge with DMA 1644includes a four level deep write FIFO and a one level read FIFO toperform the direct bridge function. Accesses to 16-bit and 8-bit devicespreferably are facilitated by automatically converting 32-bit CPUaccesses into multiple narrower I/O accesses. The I/O bus bridge withDMA 1644 supports byte swapping for coupling big-endian devices to alittle-endian CPU. ROM and/or flash memory for system boot andpersistent storage functions preferably is attached directly to the I/Obus bridge with DMA. The I/O bus bridge with DMA 1644 may also supportbyte swapping for coupling little endian devices to a big-endian CPU.

The I/O bus bridge with DMA 1644 preferably is capable of being coupledto QAM link front-end, cable modem, and any additional communicationsand I/O functions that may be required either for system development anddebug or for production.

The I/O bus bridge with DMA 1644 to SDRAM communications may includeboth a full scatter-gather linked-list DMA engine and support forexternal bus masters. The DMA engine preferably supports twobi-directional channels, each of which may have its own linked list ofbuffer descriptor records. The buffer descriptors preferably providedirect support for full scatter-gather DMA operations, with access tothe full address space of both the SDRAM and the I/O bus and variousdifferent size transfers, using lists of descriptors that may access upto 4 KB each.

The linked-list DMA engine may be used with various different types ofcable modems. The linked-list DMA engine preferably allows transparenthigh-speed transfer of all upstream and downstream data traffic,allowing networking software in the CPU to read and write data at fullSDRAM speeds without occupying CPU bus bandwidth during DMA transfers.The DMA linked lists preferably are established by software, which maymonitor and control the operation of the DMA engine while in progress.The system bridge controller to SDRAM interface preferably includes atwo level deep FIFO for writes (to the I/O module) and a one level deepFIFO for I/O reads. Byte swapping preferably is supported in the systembridge controller to SDRAM path to support little-endian CPUs.

The system bridge controller preferably supports delayed read and retryof reads by external masters. This typically allows higher I/O busthroughput, as it generally avoids the need for the external master tohold the bus while waiting on read cycles. The system bridge controllerpreferably also supports retry cycles when it is the master, i.e., whenthe CPU or DMA engine are reading from I/O devices.

External bus masters may be coupled directly to the I/O bus bridge withDMA 1644. One external bus master may be coupled directly, and utilizethe bus request (BR#), bus grant (BG#) and bus grant acknowledge(BGACK#) signals on the system. Additional masters may be coupled to theI/O bus module through the use of glue logic to provide additionallevels of bus arbitration.

The system bus controller 1648 preferably supports both big-endian andlittle-endian configurations of the CPU and operating system. Thisfeature generally eliminates the need for software to intercept andreformat reads and writes when the video-audio-graphics device has adifferent endian-ness configuration from the CPU and operating system.

All functions of the system that are affected by the choice ofendian-ness preferably are configured at reset into the selected mode,including graphics and video display and the audio engine. The I/O busbridge with DMA and the PCI bridge preferably convert I/O and DMAaccesses between the big-endian I/O bus, little-endian PCI bus and thelittle-endian memory and CPU format when the system is in little-endianmode.

The CPU interface block 1646 preferably integrates a CPU interface thatis configurable for both MIPS “SYSAD” and Hitachi SH4 “MPXBus” CPU busdefinitions. Both modes implement a multiplexed address and datastructure, with 32 bits of address and data. Both CPU modes fullysupport burst accesses in both read and write directions, for maximumperformance with any mix of CPU I-cache loads, D-cache loads, D-cachewrite-backs, and uncached data reads and writes.

The CPU interface block 1646 preferably provides a direct, glue-lessinterface to both MIPS and SH3/SH4 processors through a CPU interface1660.

The CPU interface 1646 preferably includes extensive data bufferingcapabilities, supporting posted writes with up to four cache lines ornon-cache words, in any combination and order, and with a read FIFO tomatch the full SDRAM bandwidth to processors with slower bus speeds.

The CPU bus interface 1646 may operate at a clock frequency that isindependent of the core and other interface clocks of the system,providing flexibility in system design and implementation. The maximumfrequency of the CPU bus clock in one embodiment of the presentinvention is 81 MHz. The CPU interface of the system preferably operatesas a slave on the CPU bus.

XXII. Parallel Processing of Graphics Windows

The system of the present invention preferably includes a displayengine. The display engine preferably is a component of thevideo-graphics display and scale engine 1638 in FIG. 40. The displayengine blends graphics windows created by software applications intoblended graphics. The blended graphics is composited together withdigital video and digitized analog video in a video compositor, whichpreferably also is a component of the video-graphics display and scaleengine 1638.

Any conventional display engine may be used for blending, filtering andscaling graphics. For example, one embodiment of the present inventionincorporates the display engine used in one embodiment of the inventiondescribed in commonly owned U.S. patent application Ser. No. 09/437,208,filed Nov. 9, 1999 and entitled “Graphics Display System,” the contentsof which are hereby incorporated by reference.

FIG. 61 is a process diagram that illustrates combination of graphicswindows 2500, 2502 and 2504 into blended graphics and then compositionwith video contents 2506 to form a single blended graphics and videowindow 2508 in one embodiment of the present invention. The displayengine preferably performs blending/mixing of the graphics windows intothe blended graphics. The blended graphics preferably is then combinedwith the video 2506 to form the single blended graphics and video window2508.

FIG. 62 is a block diagram that illustrates a system-level view of adisplay engine 2514 coupled with other components to perform itsfunction. A window control block 2512 preferably retrieves graphics datafrom an external memory 2510, puts them into correct format, andprovides the formatted graphics data to the display engine 2514.

The window control block 2512 preferably sorts the window descriptorsaccording to the relative depth of their corresponding windows on thedisplay. For graphics windows, the window control block 2512 preferablysends header information to the display engine 2514 at the beginning ofeach window on each scan line, and sends window header packets to thedisplay engine as needed to display a window. The window control block2512 may also coordinate capture of video into an external memory andtransfer of video from the external memory into the video compositor2516.

In one embodiment of the present invention, the external memory 2510preferably has a unified memory architecture (UMA). In other words, theexternal memory 2510 preferably is concurrently used by variousdifferent devices such as CPU, the display engine, and the MPEG decoder.The memory 2510 may be implemented in a synchronous dynamic randomaccess memory (SDRAM) or any other suitable memory.

A video compositor 2516 preferably provides timing information to thedisplay engine so that the display engine 2514 may send blended graphicsto the video compositor to be blended with the video contents. Theblended graphics, often composited with the video contents, preferablyis displayed on a television set 2518.

Since the system is used for high definition TV, the time to composite ascan line is typically limited. The number of pixels in each scan lineis typically also increased. The serial compositing is typically notfast enough at the higher speed display clock. The window controller inone embodiment of the present invention has been designed for parallelcompositing. The compositing function is implemented in four parallelpipelines. Each pipeline preferably is controlled by a separate statemachine. The sorting logic is based on Y scan line order and window X(horizontal) start position. The left-most window is typically processedfirst. The right-most window is typically processed last. The sortingorder is an ascending order. The window descriptor with smaller numberof Y scan line order and X start position is typically processed first.

FIG. 63 is a block diagram of the window control block 2512 in oneembodiment of the present invention. The window control block 2512preferably performs the window display controlling functions including:loading window descriptors from memory, parsing and sorting of thewindow descriptors, state machine functions to control the windowdisplay operations, assembling window headers and sending them tographics FIFOs, DMA operation to transfer pixel information from memoryto graphics FIFOs, DMA operation to load CLUT, and local arbitration ofaccess to memory. The window control block 2512 in the embodiment ofFIG. 63 includes five modules: a window controller 2520, a CLUT DMAmodule 2532, a window DMA module 2533, a window arbitrator 2542 and awindow bus module 2544.

The window controller 2520 preferably loads window descriptors fromexternal SDRAM through a memory bus interface 2546 and parses thedescriptors to decide which window area is to be displayed on thescreen. The window controller 2520 preferably stores up to eight windowdescriptors. In other embodiments, the window controller 2520 may storemore or less than eight window descriptors. The window controller 2520may also include a window descriptor (WD) update DMA and other controllogic. The window controller 2520 preferably performs window descriptorcontrol logic functions such as window descriptor sorting and windowdescriptor status update.

The window controller preferably includes four window state machines: afirst window state machine 2524, a second window state machine 2526, athird window state machine 2528 and a fourth window state machine 2530.The four window state machines preferably perform window controloperation in parallel to meet HD graphics timing requirement. Inaddition, the window controller 2520 preferably includes a windowdescriptor state machine 2522, which manages loading of windowdescriptors from external memory.

The CLUT DMA module 2532 preferably handles updating of a color lookuptable (CLUT). The CLUT DMA module 2532 preferably receives requests fromthe window state machines to update the CLUT. In response, the CLUT DMAmodule sends a request to the window arbitrator 2542 to read the CLUTdata from external memory, e.g., SDRAM, and then sends the data togetherwith write strobe to the display engine to update the CLUT. The CLUT DMAmodule 2532 preferably also separates each memory request into manysmall burst sized requests. The CLUT DMA module 2532 preferablycalculates the correct transfer size and increments the address for eachmemory request.

The window DMA module 2533 preferably takes requests from the windowstate machines to fill the graphics FIFOs. In response, the window DMAmodule 2533 preferably sends request to read the current window datafrom external SDRAM and writes to graphics FIFOs. The window DMA modulealso assembles the header packet for new line and new window conditionand sends to the graphics FIFOs. The window DMA module preferably alsosends line end headers to the graphics FIFOs. The window DMA modulepreferably includes four DMA modules, DMA module 1 2534, DMA module 22536, DMA module 3 2538 and DMA module 4 2540 for parallel processing ofwindow graphics data. Each of the four DMA modules 1-4 sends memoryrequests to the window arbitrator and writes header data or pixel datato four graphics FIFOs in the display engine. The window DMA module 2533preferably also separates each memory request into many small burstsized requests. The window DMA module 2533 preferably calculates thecorrect transfer size and increments the address for each memoryrequest.

Therefore, the window DMA module 2533 controls sending of new windowheader, line end header and the graphics memory read request frommemory. The window DMA module preferably has a burst size option. Theburst size is programmable to be either 32-oword or 16-oword. The owordis defined to be 64-bit word. The CLUT DMA module 2532 is similar to thewindow DMA module except that this module does not control the sendingof header packet.

The window arbitrator 2542 preferably performs round-robin arbitrationbetween four window DMA requests, one CLUT DMA request and one windowdescriptor (WD) load request. Based on the arbitration result, thewindow arbitrator selects the correct address and size for the memoryrequest and sends the memory request 2548 to a memory controller. Thewindow arbitrator also multiplexes the requested memory address andmemory size and send to the window bus module 2544.

The window bus module 2544 converts the memory requests to memory busprotocol and interfaces directly with the memory controller over amemory control interface 2550. The window bus module 2544 preferablyalso communicates with the memory controller and the window arbitratorto decide the bus ownership. The window bus module also controls theoutput enable of the bus and drives the memory request size when itacquires the bus ownership.

Therefore, the window bus module 2544 converts between memory busprotocols. The window bus module preferably detects memory acknowledgeidentification for the request acknowledgment and detects memory readidentification for the data acknowledgment. The window bus module alsocombines requested address and size into a 32-bit command (m_cmd[31:0])and drives the tri-state command bus.

The format of the window descriptor preferably is compatible with videohaving HD resolution. In one embodiment of the present invention, thewindow descriptors have format illustrated in Table 7.1

TABLE 7.1 Window Descriptor Format Window Descriptor Parameter 0win_mem_start mem_data[25:0] Start Memory Address of the Graphics Datawin_format mem_data[29:26] Window Format win_operation mem_data[31:30]Window Operation Window Descriptor Parameter 1 win_color mem_data[15:0]Color for Window win_mem_pitch mem_data[27:16] Memory Pitch for Windowwin_layer mem_data[31:28] Window Layer Number Window DescriptorParameter 2 win_ystart mem_data[10:0] Y Starting Value for Windowwin_yend mem_data[21:11] Y Ending Value for Window win_alphamem_data[29:22] Alpha Value for Window Alpha_type mem_data[31:30] AlphaExtraction Method Window Descriptor Parameter 3 win_xstartmem_data[10:0] X Starting Value for Window win_xsize mem_data[21:11] XSize of Window Blank_start_pixel mem_data[25:22] Pixels to be Blankedout at the Beginning of Window win_filt_enb mem_data[26] Enable WindowFilter Blank_start_pixel mem_data[27:22] Pixels to be Blanked out at theBeginning of Window win_filter_enb mem_data[28] Enable Window FilterReserved mem_data[31:29] Reserved

The window controller 2520 preferably contains five state machines: awindow descriptor state machine, a first window state machine, a secondwindow state machine, a third window state machine and a fourth windowstate machine.

The window controller 2520 preferably also contains up to eight on-chipwindow descriptors. The eight window descriptors preferably areimplemented in flip-flops. Each window descriptor typically includesfour 32-bit words of parameters. In other embodiments, the number ofwindow descriptors in the window controller may be more or less thaneight, and the number of 32-bit words in each window descriptor may bemore or less than four.

The window controller 2520 preferably updates the status of each on-chipwindow descriptor using a window status flag. The window status flag isa 2-bit flag associated with each window descriptor (WD), and indicateswhether the associated WD should be processed at current line or not. Asorting logic preferably sorts the window descriptors based on the Yscan line order and X start position. Each window state machineprocesses particular window descriptor based on this sorting result.

The memory start location of each window preferably is kept in theassociated window descriptor. However, each time the scan line countincrements, the memory start location preferably is added with a memorypitch offset. If the output is an interlaced display, two times memorypitch is added to the window memory start address. If the output is anon-interlaced display, only one memory pitch is added to the windowmemory start address. This process is performed every time a windowdescriptor finishes processing on each line. A carry look ahead adderpreferably is used for timing purposes.

FIG. 64 is a block diagram of one embodiment of the window controller2520 illustrating interactions between the five state machines includedin the window controller. The window descriptor state machine 2522 loadsthe window descriptors from the external memory and provides to thewindow state machines 2524, 2526, 2528 and 2530 in response to requestsgenerated by a window descriptor request generator 2550. The windowdescriptor request generator 2550 requests to the window descriptorstate machine in response to the requests by the four window statemachines. The window state machines 2524, 2526, 2528 and 2530 preferablyperform sorting of the received window descriptors.

The window descriptor state machine 2522 preferably manages the on-chipwindow descriptor loading from external memory. The loading of windowdescriptors may be separated into two categories: initial loading andupdate loading.

An initial loading is the loading of window descriptors (WDs) after thevertical sync. In one embodiment of the present invention, up to eightWDs are loaded during the initial loading. The window descriptorinitiation flag is set during the initial loading. This windowdescriptor initiation flag is used as a kick-off signal for the fourwindow state machines. An update loading is the WD loading during middleof display. An update loading typically is performed when the totalnumber of WDs is greater than eight. A window load pointer, which is acontrol logic, keeps track of which WD is to be loaded into the windowcontroller. During the initial loading, the window load pointer islinearly incremented.

Each window descriptor has an associated window status parameter, eachwith an associated value. Table 7.2 gives values and descriptions of thewindow status parameters used in one embodiment of the presentinvention.

TABLE 7.2 DEFINITION OF WINDOW STATUS PARAMETERS Window Status ParameterValue Description NOT_PROC 1 Not Processed CUR_PROC 0 Currently BeingProcessed DONE_PROC 2 Already Processed NULL_WD 3 Invalid WindowDescriptor

During the update loading, the window load pointer points to the WD witha window status of DONE_PROC, which is set when last line of the windowassociated with this WD is less than the current line count. In otherwords, when the current display line is below the last line of a windowassociated with the WD, the display of that window has been completed.Thus, the window status of DONE_PROC indicates that the associated WD iscompletely processed. A counter records the number of window descriptorswith DONE_PROC status. The value of this counter is used to determinethe number of WD to be loaded during the update loading.

FIG. 65 is a state diagram that illustrates operation of one embodimentof the WD state machine 2522. The WD state machine 2522 in the describedembodiment has following six states: WD_IDLE, WD_INIT, WD_PARAM,WAIT_LINE_DONE, WD_UPDATE and WD_UPD_PARAM. Upon system start up, the WDstate machine enters the WD_IDLE state in block 2552. In this state, theWD state machine waits to receive a vertical sync.

When a vertical sync is detected as indicated in block 2554, the WDstate machine 2522 enters the WD_INIT state in block 2556. In theWD_INIT state, the WD state machine 2522 preferably sends a request toread window descriptors from the external memory, e.g., SDRAM. In theWD_INIT state, a WD initialization flag is set to indicate that initialloading of window descriptors is to start.

Then the WD state machine 2522 enters the WD_PARAM state in block 2558.In the WD_PARAM state, up to eight window descriptors are read from theexternal memory and loaded into the window controller. When the lastwindow descriptor of the current line is reached, regardless of thenumber of window descriptors that have been loaded, a last windowdescriptor flag is set to indicate that the last window descriptor hasbeen loaded. The WD state machine in block 2560 checks to determine ifthe last window descriptor flag has been set.

If the last window descriptor flag is set, the WD state machine 2522exits the WD_PARAM state and enters the WAIT_LINE_DONE state in block2562. Upon exiting from the WD_PARAM state, the WD initialization flagis reset to indicate that the initial loading of window descriptors havebeen completed. While the WD state machine is in the WAIT_LINE_DONEstate, the window descriptors are processed until all four window statemachines complete processing of the current line. The WD state machinein block 2564 checks if all four window state machines have completedthe current line processing. If the processing has been completed, theWD state machine checks if there is any request for window descriptorsin the window descriptor request queue in block 2566. If there is norequest for window descriptors, the WD remains at the WAIT_LINE_DONEstate.

If there is any request for window descriptors, the WD state machineenters the WD_UPDATE state in block 2568. In the WD_UPDATE state, thewindow state machines send request to the WD state machine to loadadditional window descriptors in update loading mode. In the WD_UPDATEstate, a window descriptor update flag is set to indicate that an updateloading is to take place.

Then the WD state machine 2522 enters the WD_UPD_PARAM state, which issimilar to the WD_PARAM state. In the WD_UPD_PARAM state, as long as thememory controller provides valid data, window descriptors are loadedinto the window controller in the update loading mode. Similar to theWD_PARAM state, up to eight window descriptors are loaded until the lastwindow descriptor of the current line is loaded.

If eight window descriptors have been loaded or the last windowdescriptor of the current line has been loaded, the WD state machine inblock 2570 checks to see if a last window descriptor flag has been set.The last window descriptor flag is set when the last window descriptorof the field has been loaded. If the last window descriptor flag is notset, the WD state machine returns to the block 2566 to check if there isany window descriptor request in the queue. If the last windowdescriptor flag is set, the WD state machine returns to the WD_IDLEstate to wait for the next vertical sync to start the process of loadingand processing window descriptors for the next field.

FIGS. 66 and 67 are a state diagram that illustrates operation of oneembodiment of the first window state machine 2524. The first windowstate machine preferably controls one of four graphics pipelines in thedisplay engine. In the described embodiment, the other three windowstate machines 2526, 2528 and 2530 have identical states and statediagrams as the first window state machine except that the first windowstate machine maintains the line count increment and sort countincrement, unlike the other three state machines. Thus, a window statemachine is discussed below with reference to all four window statemachines.

The window state machine in one embodiment of the present invention hasthe following 21 states: WIN_IDLE, WAIT_WD_INIT, WAIT_WD_INIT1,WAIT_WD_UPD, WAIT_WD_UPD1, WAIT_WD_UPD2, WAIT_WD_UPD3, NEW_LINE,NEW_LINE1, SORT, NEW_LINE2, NEW_LINE3, NEW_CLUT, NEW_WIN, NEW_WIN_ACK,WIN_MEM, WIN_MEM_DONE, WIN_MEM_DONE1, WIN_MEM_DONE2, WIN_MEM_DONE3 andLINE_END. In other embodiments, number of states may be more or lessthan 21, and the states may also be different.

In the WIN_IDLE state 2572, a line count and a sort count preferably arereset. The line count preferably is updated at the beginning of eachfield. The line count is then incremented by one or by two depending onwhether the display is progressive or interlaced. The incrementation isperformed when all window descriptors in the current line are processed.The sort count preferably is used for sorting eight window descriptors.The sort count is used as a pipe line delay counter as well as sortingindex.

The window state machine waits in the WIN_IDLE state 2572 until avertical sync is detected in block 2574. When the vertical sync isdetected, the window state machine enters the WAIT_WD_INIT state inwhich setting of the WD initialization flag is checked in block 2576.The WD initialization flag is set by the WD state machine to indicateinitial loading of the window descriptors, as discussed in reference toFIG. 65. Upon setting of the WD initialization flag, the window statemachine enters the WAIT_WD_INIT1 to wait for resetting of the WDinitialization flag. As discussed in reference to FIG. 65, the WD statemachine resets the WD initialization flag to indicate completion of theinitial loading of up to eight window descriptors.

When the WD initialization flag is found to be reset in block 2578, thewindow state machine enters the NEW_LINE state 2582 in which the linecount is incremented by the first window state machine in the describedembodiment. In other embodiments, the line count may be incremented byone or more of the other window state machines. Then the window statemachine enters the NEW_LINE1 state 2584 in which the window status isupdated. The window status is updated when there is a line countincrement.

Then the window state machine enters the SORT state 2586 to startsorting of the window descriptors. In the described embodiment, thefirst window state machine increments the sort count in block 2588 untilthe sort count reaches 7. In other embodiments, the sort count may beincremented by one or more of the other window state machines.

When the sort count reaches 7, the window state machine enters theNEW_LINE2 state 2590 in which the window indexes are assigned. A firstwindow index, used by the first window state machine, points to thewindow descriptor to be serviced by the first window state machine forthe first graphics pipeline. The first window index is typically set tosort[0] at the beginning of each field/frame. The sort [0] indexes thewindow descriptor with the smallest sorting parameters. The secondwindow index, used by the second window state machine, is typically setto sort[1] at the beginning of each field/frame. The third window index,used by the third window state machine, is typically set to sort[2] atthe beginning of each field/frame. The fourth window index, used by thefourth window state machine, is typically set to sort[3] at thebeginning of each field/frame.

Upon exiting the NEW_LINE2 state 2590, the window state machine entersthe NEW_LINE3 state in which the indexed window is checked in block 2592to determine whether the indexed window is currently processed, i.e.,the index window has a window status of CUR_PROC. If the indexed windowis not a currently processed window, the window state machine enters theLINE_END state 2622 in FIG. 67 as indicated by a state change indicator2594.

However, if the indexed window is a currently processed window, thewindow state machine in block 2596 checks if the window descriptorassociated with the currently indexed window is for loading CLUT. If thewindow descriptor is for loading CLUT, the window state machine entersthe NEW_CLUT state 2598 in which a CLUT memory request is sent to thememory controller for loading new CLUT data from the external memory.Then the window state machine enters the WIN_MEM_DONE state 2614 in FIG.67 as indicated by a state change indicator 2600. If the windowdescriptor is not for loading CLUT, the window state machine enters theNEW_WIN state 2604 in FIG. 67 as indicated by a state change indicator2602.

In the NEW_WIN state 2604, the window state machine sends a new windowrequest to the WD state machine to receive a new window header. Thewindow state machine waits for the new window to be acknowledged by thewindow arbitrator as indicated in block 2606. If the new window isacknowledged, then the window state machine enters the NEW_WIN_ACK state2606 in which the window state machine checks whether the window formatis an ALPHA0 format. Since ALPHA0 format defines a special type ofwindow having a single color, no graphics pixel data typically is readfrom the external memory for windows having ALPHA0 format. Thus, if thewindow state machine in block 2608 determines that the window has ALPHA0format, the window state machine enters the WIN_MEM_DONE state 2614without loading any graphics pixel data.

When the window does not have ALPHA0 format, the window state machinesends a window memory request to the window arbitrator to read graphicspixel data from the external memory. Then the window state machine waitsfor the corresponding window DMA module to acknowledge the transfer ofgraphics pixel data.

Upon acknowledgment of the graphics pixel data transfer as indicated inblock 2612, the window state machine enters the WIN_MEM_DONE state 2614.In this state, if the line count is greater than the last line of thewindow associated with this window descriptor, a window line done flagis set for this window descriptor to indicator that the processing ofthis window descriptor has been completed.

The window state machine then enters a WIN_MEM_DONE1 state 2614 in whichthe next WD index is obtained from a sort_4567 sorting index. The windowstate machine also requests to increment the sort_4567 index. Each ofthe first window index, the second window index, the third window index,the fourth window index, sort[0], sort[1], sort[2], sort[3], sort[4],sort[5], sort[6], sort[7] and sort_4567 is a 3-bit register set forindexing of eight window descriptors.

After the WIN_MEM_DONE state 2614, the window state machine enters theWIN_MEM_DONE2 state 2616 in which sort_4567 is compared against 7 asindicated in block 2618. The sort_4567 sorting index is a register setwhich typically points to the next window descriptor index to beserviced. For example, when sort[0] to sort[3] are being serviced at thebeginning of field/frame, the sort_4567 points to sort[4]. When one ofthe pipeline completes processing of one window descriptor, the windowstate machine associated with that pipeline typically referencessort_4567 to point to sort[4] to find the next window descriptor forprocessing. The register set sort_4567 is then incremented by one topoint to the next sorting which is sort[5]. This process repeats untilsort_4567 equals 7, which means that all eight of the window descriptorson the current line have been processed. The sort_4567 is reset back to4 for the processing of next line.

When the sort_4567 is less than or equal to 7, the window state machinechecks in block 2620 whether a window increment has been acknowledged.If the window increment has been acknowledged, the window state machinereverts back to the NEW_WIN state 2604 to send another window request toobtain a new window header. If the window increment has not beenacknowledged, the window state machine enters the WIN_MEM_DONE1 state toget the next WD index from sort_4567 and request to increment sort_4567.

When the sort_4567 index is greater than 7, the window state machineenters the LINE_END state 2622. In the LINE_END state, the window statemachine sends a line end request to the window arbitrator to send a lineend header. While in the LINE_END state, the window state machine checkswhether a field end flag is set in block 2624. If the field end flag isset, the window state machine keeps requesting a line end header untilthe next vertical sync, i.e., vsync, is received.

When all the window descriptor status shows DONE_PROC and no more WD isto be updated, WD request queue is empty, and last WD is loaded, thefield end flag is set. All four window state machines preferably stay inthe LINE_END state 2622 and keep sending line end header until avertical sync is detected. The vertical sync resets all five statemachines and re-start the process for next field/frame.

If the field end flag is not set, the window state machine enters theWAIT_WD_UPD state 2626 and waits for the new WD update loading by the WDstate machine. When all four window state machines reach the WAIT_WD_UPDstate 2626, a line done flag is generated. The line done flag is used bythe WD state machine to start a WD update loading process. In theWAIT_WD_UPD state 2626, the window state machine increments the linecount and enters the WAIT_WD_UPDATE1 state 2628. In the WAIT_WD_UPD1state 2628, the window state machine waits for the WD state machine toreset the WD update flag to indicate completion of the WD updateloading. After the update loading of window descriptors completes,indicated by reset of the WD update flag, all four window state machinesenter a NEW_LINE 2582 in FIG. 66 state to process the next line asindicated by a state change indicator 2580.

Both Y scan line order and X starting position in the describedembodiment are defined in 11-bit registers to cover HD resolutions.Sorting of eight on-chip window descriptors based on 22-bit parameterstypically takes many levels of logic, large gate counts and longpropagation time to complete the sorting. The large area ofcombinational logic with long propagation delay usually cause problem inback-end timing driven layout.

Reduction in the number of bits, gate counts and the multiple clocks ofpropagation delay is important and beneficial to back-end routing,especially in a large and complicated system-on-chip design.

In the system implementation in one embodiment of the present invention,the 11-bit Y scan line order is replaced by a 2-bit window status.Window status of each window descriptor is derived by comparing itswin_ystart and win_yend parameters with the current line count. Bothwin_ystart and win_yend are part of window descriptor parameters. Thewin_ystart parameter is defined as the window starting scan line. Thewin_yend parameter is defined as the window ending scan line.

A line count is a counter in the window controller. The line counttracks the currently processed scan line number. If the line count issmaller than win_ystart, the window status for this window is set toNOT_PROC. If the line count is between win_ystart and win_yend, thewindow status for this window is set to CUR_PROC. If the line count isgreater than win_yend, the window status of this window is set toDONE_PROC. If this window descriptor is not a valid window descriptor,the window status of this window is set to NULL_WD.

For example, when the total number of WD is less than on-chip WD number,eight, the last few window descriptors are defined to have a windowstatus of NULL_WD since they don't contain a valid window. The windowstatus of all the on-chip window descriptors are updated at thebeginning of each scan line. A window status bit is available in thewindow controller and is also used by each state machine for otherpurpose.

The window status of CUR_PROC is assigned to a smallest value, which is0. During window descriptor sorting, the two-bit window status isassigned to two most significant bits. With this arrangement, thecurrently being processed window will be sorted to the highest prioritybecause the two most significant bit is smallest. With this approach,the 11-bit Y scan line order is replaced with 2-bit window status. Thisreduces the number of bits in the sorting parameters from 22 down to 13.In one embodiment of the present invention, the sorting parameters inverilog code is defined as “sort_xstart”, which is defined as a2-dimensional array, total of 8 sorting parameters with 13-bit number ineach sorting parameter.

Even though the number of sorting bits are reduced from 22 to 13, it isstill very difficult to complete sorting of all eight window descriptorswithin one high speed clock cycle. In one embodiment of the presentinvention, the sorting logic runs at 81 MHz. In order to avoid themultiple cycle restriction for the back-end timing driven layout,sorting of eight window descriptors is performed in 8 pipeline stages.Each stage preferably is completed within one cycle.

In the described embodiment, each stage preferably sorts for thesmallest number of sorting parameter which is 13-bit definition ofwindow status and win_xstart. This preferably is implemented as threelevels of comparison where each level of comparison uses a 13 bitcomparator. When the smallest number of sorting parameters is found, thesmallest window descriptor index is saved to a result register and thesorting parameter of this window descriptor is replaced with 0x1fffwhich is the largest number.

The propagation delay of the 3-level comparator logic may be achieved inone 81 MHz clock cycle using 0.22 mm technology. During the secondpipeline stage, since the smallest sorting parameter is replaced with0x1fff, the second smallest sort parameter typically is found and savedin a result register, then replaced with 0x1fff. There is a sortingcounter which is incremented at each pipeline stage. This counter isalso used as an index to save the window descriptor to the correctresult register and to replace the corresponding sorting parameter with0x1fff.

After eight cycles of sorting, all eight window descriptors are sortedin ascending order based on their sorting parameters which representstheir Y scan line order and X start position. With this approach, thereis no need to define multiple cycle restriction for timing driven layoutand the design may be implemented in fully synchronous logic.

Thus, the complicated 22-bit sorting logic is reduced to 13-bit sortingin the described embodiment of the present invention. Further, thecomplicated sorting logic is further simplified to 3-level comparator tolocate the smallest index. This 3-level comparison logic preferably isreused in the eight sorting cycles. During each sorting cycle, thesmallest index is identified and then replaced with largest number fornext clock sorting. This typically results in minimum gate counts.

FIG. 68 is a priority diagram that illustrates window arbitrationpriorities. The window arbitrator performs arbitration between windowdescriptor loading, color lookup table loading and four window memoryrequests. The color table lookup loading 2630 typically has the highestpriority. The four window memory requests 2632, 2634, 2636 and 2638typically have the middle priority and is arbitrated in a round-robinmanner. The window descriptor loading 2640 typically has the lowestpriority.

The display engine 2514 preferably receives the graphics data intographics FIFOs. The display engine preferably first converts thegraphics data into graphics windows having a common internal format. Thegraphics windows preferably are blended together in graphics blenders,where the graphics windows are overlaid on top of each other accordingto their layer depth order. The output of the graphics blenders, i.e.,blended graphics, preferably is stored in a buffer and then filtered foraspect-ratio correction and/or high frequency content removal. Thefiltered blended graphics preferably is provided to the video compositorto be combined with the video contents.

Thus, the display engine in one embodiment of the present inventionpreferably performs following major tasks:

1) graphics format conversion;

2) capable of processing 4 graphics layers at the same time using 81 MHzprocessing clock;

3) perform graphics composition and blending;

4) perform aspect-ratio correction (SRC) and anti-flicker filtering(AFF) in SD mode.

The display engine preferably constructs screens of video and graphicsusing visual “surfaces”, which may also be called “windows”, “regions”,“sprites”, “objects”, or “canvasses”. Each visual surface preferably isindependent of the others, and may have its own image pixel format,alpha blend factor, location on the screen, address in memory, and otherparameters. The display engine may support a variety of pixel formatsincluding RGB16, RGB15, YUV 4:2:2 (ITU-R 601), CLUT2, CLUT4, CLUT8, andothers. In addition to each surface having its own alpha blend factor,each pixel may also have its own alpha blend factor; this capability maybe used to advantage in creating top quality imagery.

Visual surfaces may be comprised of any combination of image contents,such as anti-aliased text, patterns, GIF images, JPEG images, live videofrom MPEG or analog video, 3D graphics, backgrounds, pointers, controlpanels, etc., all of which may be smoothly animated as desired. Surfacesof different types may be readily layered one on top of another. Forexample, anti-aliased text may as easily be on top of live video as ontop of graphics imagery or a solid colored background.

In one embodiment of the present invention, surfaces preferably arecomposited directly to the screen at the time the screen is displayed.Thus, in the described embodiment, display frame buffers, buffereddisplays, or off-screen bit maps may not be needed. Since frame buffersneed not be constructed for every new view of the screen, high-bandwidthblitter functions to perform animations and compositing may not beneeded. As a result, the described embodiment of the present inventionpreferably allows a dramatic reduction in memory requirements and inmemory bandwidth demands, when compared with conventional PC-type andblitter-based architectures.

In other embodiments, the surfaces may be stored in display framebuffers prior to being displayed. In these cases, display frame buffers,buffered displayed and/or off-screen bit maps may be used.

Display surfaces preferably are controlled by a display list mechanismusing window descriptors. The window descriptors in memory preferablycontrol all the surfaces on the screen with the parameters of eachsurface, and the hardware reads the window descriptors when theinformation is needed in order to construct the display screen. Multiplewindow descriptors may be stored in memory simultaneously, and they maybe selected automatically by the hardware at the beginning of everydisplay field.

The number of surfaces (windows) that may be displayed simultaneously istypically very large and supports very demanding applications. In oneembodiment of the present invention, every display scan line may have aunique set of up to eight graphics windows, in addition to the two videowindows, either or both of which may be full screen video or scaledvideo, and background surfaces. In other embodiments, the numbers ofgraphics display surfaces on each scan line may be more or less. In oneembodiment of the present invention, up to four graphics windows, plusthe two video surfaces and background, may be overlaid at every pixel.In other embodiments, the numbers of graphics windows that may beoverlaid at every pixel may be more or less than four.

Pointers, e.g., cursors, preferably are readily supported in hardwaresimply by creating another display surface. Pointers may have all theproperties and flexibility of normal graphics windows.

The display engine preferably supports simultaneously the various typesof alpha blending that are required by advanced applications and for topquality text and graphics display. Alpha blending in the display enginepreferably supports a full 8 bits (256 levels) of alpha control on aper-window and per-pixel basis simultaneously, in all graphics formats.Alpha values preferably are determined individually for each window andpixel, regardless of the number of layers of windows composited andregardless of the depth order of the window on the display.

Fewer than eight bits of alpha may be desired for many importantfunctions. For example, only two bits per pixel are generally adequatefor very high quality anti-aliased text, and four bits per pixeltypically produces a result that is visually as high quality as eightbits per pixel text. Using smaller number of bits per pixel generallysaves memory and memory bandwidth. The per pixel alpha values, includingones that have two or four bits, preferably are combined with the persurface alpha value to produce an 8-bit alpha result within the displayengine.

The display engine preferably also includes a high quality anti-flutterfilter which eliminates the flutter effect that is inherent tointerlaced display of high resolution text and imagery on standarddefinition TVs. Unlike other solutions with a filter that processes theoutput of a graphics engine, the anti-flutter filter in the displayengine of the present invention generally does not affect the display ofnormal or scaled live video, which is meant for interlaced display andwhich would be distorted by a filter. In addition, the display enginepreferably eliminates most sources of flutter even without utilizing theanti-flutter filter.

In many practical applications such as web browsing or using computergenerated graphics, the graphical content is generally coded with squareaspect ratio pixel sampling, e.g., 640×480 resolution, while thestandard for digital video on standard definition TV displays (ITU-RBT.601) specifies a pixel aspect ratio that is not square. The displayengine of the present invention may optionally adjust the pixel aspectratio of the graphics to match that of the video. Further, the pixelaspect ratio scaling in the display engine preferably matches thegraphics size to the displayable size of normal TVs. In addition, thedisplay engine preferably supports display of the same graphical contenton both NTSC and PAL/SECAM televisions without modifying the graphicsimagery.

The pixel aspect ratio matching function and the anti-flutter filterpreferably are integrated into one optimized multi-tap polyphasevertical filter and sample rate converter, for maximum quality andminimum hardware complexity. The parameters of this filter preferablyare fully programmable, supporting custom filter designs.

As with the anti-flutter filter, the pixel aspect ratio matchingfunction preferably does not have any effect on either full screen orscaled live video, while at the same time there may be a large number ofgraphics surfaces composited anywhere on the screen with aspect ratiocorrection.

FIG. 69 is a block diagram of the display engine 2514 in one embodimentof the present invention and its major functional blocks. The displayengine 2514 preferably receives graphics data from the window controllerthrough inputs 2720A-D into four parallel graphics FIFOs 0-3 2722A-D.The display engine preferably processes the graphics data in the FIFOs0-3 2722A-D in parallel and in synchronization such that the graphicsdata are aligned to each other pixel by pixel in the processingpipelines. In other embodiments, the graphics data may be processed inseries, line by line.

These graphics data preferably are converted from their native formatinto a common internal format, YUV 4:4:4:4, by going through RGB-TO-YUVconversion (for RGB type of graphics) or by looking-up from colorlook-up tables (CLUTs) 2726A-D (for CLUT type of graphics). In oneembodiment of the present invention, each of the CLUTs 2726A-D isassociated with and is used with one of the graphics converters 0-32724A-D. In other embodiments, each CLUT may be associated with two ormore graphics converters. In still other embodiments, the system mayinclude just one CLUT associated with all the graphics converters.

A graphics controller 2728 preferably controls blending of the graphicswindows from the graphics converters 0-3 2724A-D in accordance with thelayer depth order. The graphics windows from the graphics converter 02724A and the graphics converter 1 2724B preferably are blended witheach other in the graphics blender 1 2730A. Similarly, the graphicswindows from the graphics converter 2 2724C and the graphics converter 32724D preferably are blended with each other in the graphics blender 22730B. Outputs of the graphics blenders 1-2 2730A-B preferably areblended together in the graphics blender 3 2730C into the blendedgraphics.

In one embodiment, the blended graphics preferably is temporarily storedin six graphics line buffers 2736A-F that comprise a buffer 2734. Inother embodiments, more or less line buffers may be used. In oneembodiment of the present invention, contents of a selected line bufferpreferably is read out and filtered in a graphics filter 2732 to removehigh-frequency component and/or aspect-ratio correction, and then takenout as the blended graphics output 2738 to be mixed with video. Inanother embodiment, the contents of the selected line buffer is readout, then taken out to be mixed with video without being filtered. Inother embodiments, the contents of the selected line buffer mayoptionally be filtered.

In a typical application, graphics data is created by a high-levelapplication tool, e.g., a browser, as individual graphics windows. Alower-level driver for the integrated circuit (IC) chip is typicallyused to communicate with the IC chip to “load” the graphics windows intoa unified memory at external memory location, e.g., the memory 2510 inFIG. 62, so that they may be retrieved to be displayed. Each graphicswindow is typically treated as an independent object, which may becreated and modified by any graphics creation tool.

Geometry and physical locations of graphics windows in the graphics datapreferably are described by using a list of window descriptors. Eachnode in the list typically describes properties of a graphics window,its format, alpha type, geographical locations, etc. The windowdescriptor list preferably is created and stored in a memory locationretrievable by the window controller and loaded into the on-chip buffersduring graphics display. The window descriptor list preferably ispre-sorted in accordance with the vertical start location of allgraphics windows so that the graphics may be loaded for displaysequentially line by line.

During graphics display, the window controller preferably loads thewindow descriptors according to the order of vertical start locations ofall graphics windows to be displayed. In one embodiment of the presentinvention, a maximum of eight window descriptors may be loaded on the ICchip. Therefore, in the described embodiment, up to eight differentgraphics windows may be displayed on any given display line. In otherembodiments, the maximum number of different graphics windows that maybe displayed on a display line may be more or less than eight.

Starting with the eight graphics windows at the beginning, e.g., fieldstart, graphics preferably is retrieved and loaded into the graphicsFIFOs line by line. When a window is finished, a new window descriptorpreferably is loaded onto the chip to replace it and the processcontinues until the end of the field is reached or until the windowdescriptor list is exhausted.

The system preferably uses a special data packet format to transfergraphics window parameters and window data to the display engine fromthe window controller through the graphics FIFOs as packetized data. Thepacketized data preferably is comprised of two parts: header andgraphics content. Graphics content data typically follows the header andsome graphics format may only require the presence of a header in apacket. A data type bit, which preferably is the most significant bit ofa FIFO word, typically indicates if the word is a header word (1) or adata word (0). A header generally is comprised of a single 129-bit word,but and graphics data may typically be of multiple 129-bit words.

Following graphics formats preferably are supported by the displayengine in one embodiment of the present invention.

1) RGB16: 5-bit red, 6-bit green, and 5-bit blue;

2) RGB15: 5-bit red, 5-bit green, 5-bit blue and 1-bit alpha;

3) RGBA4444: 4-bit red, 4-bit green, 4-bit blue, 4-bit alpha

4) CLUT2: 2-bit Color Look-Up;

5) CLUT4: 4-bit Color Look-Up;

6) CLUT8: 8-bit Color Look-Up;

7) ACLUT16: 8-bit alpha and 8-bit Color Look-Up;

8) ALPHA0: 0-bit single-color;

9) ALPHA2: 2-bit alpha single-color;

10) ALPHA4: 4-bit alpha single-color;

11) ALPHA8: 8-bit alpha single-color; and

12) YUV422: 16-bit YC (YU/YV, 8-bit Y and 8-bit C) in 4:2:2 format.Thus, the number of bits per pixel may be 0, 2, 4, 8 or 16 in thedescribed embodiment.

Other embodiments may have different number of bits per pixel. The alphavalue generally is a relative weight of a layer in the blending of twographics layers using following equation:Blended=alpha×TopLayer+(1−alpha)×BottomLayer

A graphics image typically has more than one color component. Forexample, YUV 4:2:2 images have three color components: Y, U and V. Inthis case, the resulting image preferably is derived by applying aboveequation to all three color components. A graphics image may have asingle alpha applied to the entire image in one embodiment of thepresent invention. In other embodiments, each pixel may have its ownalpha value, which may be different from pixel to pixel across theentire image.

As discussed earlier, a layer of graphics may have a single alpha valueapplied to all the pixels on the layer or each pixel may have adifferent alpha value throughout the layer. In one embodiment, fourtypes of alpha derivation methods preferably are supported. The alphaderivation methods include:

1) SINGLE: single alpha throughout the window;

2) FROM_KEY: pixel alpha derived from chroma/luma keying;

3) FROM_Y: pixel alpha derived from Y component for YUV 4:2:2 type ofgraphics;

4) FROM_CLUT: pixel alpha looked up from Color Lookup Table.

The SINGLE alpha derivation method typically results in a single alphathroughout the window. All other listed methods generally result inalpha per pixel, i.e., each pixel may have a different alpha value. Inthe display engine, regardless of which alpha derivation method is usedfor each pixel, another single alpha value, i.e., window alpha,preferably is applied to the whole window to support special featuressuch as fade-in or fade-out of a window.

The chroma key and luma key alpha derivation method used in thedescribed embodiment typically are used to derive a pixel's alpha valueby comparing the color component(s) of the pixel to a predefinedvalue(s). If the comparison is positive (in range or compared) then thealpha for the pixel is 0 (transparent) otherwise it is 1 (opaque).

When chroma key is used in RGB types of graphics, all three colorcomponents preferably are compared to a single set of range values (maxkey for the upper bound and min key for the lower bound) to ascertain ifa pixel is transparent or opaque.

When chroma key is used in CLUT types of graphics, the single pixelvalue used to index to a CLUT preferably is compared to a predefinedvalue. If they are the same, then the pixel becomes transparent,otherwise the pixel is opaque.

The luma key preferably is used with the graphics having YUV 4:2:2format. The legal range of the Y component of a YUV 4:2:2 imagetypically is between 16 and 235. When the Y component of a graphicsimage is set to zero, which may not happen in the real world, then thepixel is typically set to be transparent, otherwise the pixel istypically set to be opaque.

In system for displaying graphics, the pixel map start address shouldtypically be at a page boundary for efficient burst data read from theexternal memory, which may be SDRAM. By placing the start address at thepage boundary, maximum throughput may be maintained because SDRAM accessoverhead is typically minimized. Horizontal window scrolling generallyis equivalent to changing the window graphics data starting address.Thus, the start address may be placed at a location other than a pageboundary during horizontal window scrolling. Thus, changing startaddress may make SDRAM access inefficient.

The system in one embodiment of the present invention uses a softhorizontal scrolling mechanism to solve the problem of inefficient SDRAMaccess. In the described embodiment, instead of changing start addressfor scrolling, the original graphics data is loaded into the displayengine and preferably a number of pixels at the beginning of the startaddress are discarded. Since some of the leading pixels are discarded atthe start address, the screen in effect is scrolled left horizontally.

In the described embodiment, the screen may also be scrolledhorizontally to the right in a soft manner. For scrolling righthorizontally, the start address to the previous page/word preferably isadvanced by one and all the pixels in the new page/word areblanked/masked except for the amount to be scrolled. A mask/blank countpreferably is provided in the window descriptor to indicate the amountto be scrolled.

As discussed earlier, the blended composition graphics is blendedtogether with the video content in the video composition. Eachindividual graphics window typically has its own alpha. In addition,each pixel may have different alpha value. As a result, each pixel inthe video content underneath the blended graphics layer may havedifferent alpha values applied to different pixels.

To derive the alpha value for the video windows, following accumulationprocess preferably is performed when compositing the graphics windows:

${{Alpha}_{video} = {\underset{n = 1}{\overset{N}{\pi}}\left( {1 - {Alpha}_{n}} \right)}},$where Alpha_(n) is the n^(th) layer of the graphics windows and N is thetotal number of graphics layers on a pixel. In one embodiment of thepresent invention, four graphics windows are blended in parallel intoblended graphics and therefore, N is equal to 4.

In one embodiment of the present invention, a special ALPHA0 type ofgraphics may be used to ‘clear’ everything underneath it. The specialgraphics is typically called a see-through/clear/tunneling layer. ALPHA0image serving for this purpose preferably has its alpha derivationmethod set to ‘FROM_KEY’ (normally it should be set to SINGLE) and itswindow alpha set to 0.

As discussed earlier, the display engine preferably supports varioustypes of graphics. To blend different graphics windows together and alsoto blend the blended graphics with the video contents at the videocompositor, a common internal format preferably is used. In oneembodiment of the present invention, YUV 4:2:2+ALPHA format has beenselected as the common graphics format. Thus, in the describedembodiment after the conversion, a common 16-bit YUV 4:2:2 plus an 8-bitalpha format preferably is used in the display engine as well as therest of the system.

The graphics pixel data after compositing typically has differentmeanings from the one before blending. After blending, the luma andchroma values preferably are already multiplied with the pixel's alphavalue and the alpha portion of the pixel data is the equivalent “weight”of the layer(s) logically underneath the graphics layer.

In one embodiment of the present invention, all RAMs inside the displayengine preferably are testable by a built-in self test structure,RamBist. A RamBist controller preferably is external to the design andprovides the test vectors and controls through the RamBIST ports on thedisplay engine. These ports, except for the chip select signal ports,preferably are shared among all RAMs under test. The chip select signalports preferably are not shared because chip select signals aretypically ram depth dependent. A RamBIST wrapper generally contains eachRAM which preferably provides the appropriate multiplexing function andRamBIST mode real-time comparison under the control of a comparisonenable signal and the chip select signal. Each RAM preferably has itsown pass(0)/fail(1) flag signal going to outside.

Referring back to FIG. 69, in one embodiment of the present invention,four independent graphics conversion pipelines 2740 A-D handleprocessing of four overlapping graphics windows at the same time. Thisparallel graphics processing architecture preferably speeds up graphicsconversion process by a factor of four as compared to using only onepipeline at a time. The parallel graphics processing architecture isespecially useful for HD applications where higher display clockfrequency is generally required.

In addition to speeding up the graphics processing process, usingparallel graphics conversion architecture may also alleviate thebandwidth requirements on the pipeline so that a lower clock frequencymay be used. In one embodiment of the present invention, an 81 MHz clockis used for graphics processing. Using four parallel pipelines 2740 A-D,however, generally limits the maximum number of windows that may beoverlapped at any pixel to four.

Each of the graphics conversion pipelines 2740A-D preferably includes agraphics FIFO. Each of the graphics FIFOs 2722A-D preferably has a sizeof 32 words by 129 bits at its interface to the window controller. Eachgraphics FIFO preferably is coupled to a graphics converter having aCLUT attached to it. The graphics converter performs conversion ofgraphics format.

The graphics controller 2728 preferably provides the core control forthe display engine 2714 in that it synchronizes the four pipelines2740A-D in equal pace and stalls the pipelines if necessary so that thefour graphics windows processed in the pipelines are aligned up in orderto be blended together at a later stage.

The graphics controller 2728 preferably also redirects the four graphicswindows processed to different sources of the blenders according to thedepth (layer) number present in their window descriptors so thatgraphics layers are blended together appropriately. The graphicscontroller 2728 preferably also manages the graphics line buffer usageby selecting an appropriate line buffer to write a new line of blendedgraphics to.

Other elements in the processing chain preferably include graphicsblenders 1-3 2730A-C. Each of the graphics blender 1 2730A and thegraphics blender 2 2730B preferably blends a pair of graphics windows,respectively, and the graphics blender 3 2730C preferably performs thefinal blending of the outputs of the graphics blenders 1 and 2, 2730Aand 2730B. The blended color components are generated in the graphicsblenders. In addition, an accumulated equivalent alpha for the layersunderneath the graphics layer preferably is generated. Each line ofblended graphics preferably is stored in one of the six graphics linebuffers 2736A-F selected by the graphics controller 2728.

The last element in this processing chain preferably is the graphicsfilter employed for aspect-ratio conversion as well as anti-flutterfiltering for standard definition mode. The graphics filter preferablyis a 4-tap vertical only polyphase filter that uses programmablecoefficients.

Each graphics conversion pipeline preferably is comprised of 1) a FIFOand a FIFO controller and 2) a graphics converter. For example, thefirst graphics conversion pipeline preferably includes the graphics FIFO0 2722A having a FIFO and a FIFO controller, and the graphics converter0 2724A. Since all four graphics conversion pipelines are similar, onlythe first graphics conversion pipeline will be discussed hereon. A CLUTread port is also part of the graphics converter but typically isphysically located outside of the graphics converter.

The graphics FIFO 0 2722A preferably is a synchronous FIFO with writeport controlled by the window controller and read port controlled by thedisplay engine. The write address preferably is generated locally by theFIFO controller. Write enable provided by the window controllerpreferably is used to increment a modulo-64 counter. A synchronous resetprovided by the window controller preferably initially resets thecounter to zero at field start and then fills the FIFO whenever it hasempty space.

The RAM used as the graphics FIFO preferably has a size of 32 words by129 bit comprised of two RAMs with sizes of 32×64 and 32×65,respectively, because of the speed consideration and vendor RAM compilerlimitations.

The read port of the graphics FIFO preferably is also synchronous butpreferably is controlled by an inverted 81 MHz clock instead of thenon-inverted 81 MHz clock. The reason for using the invented 81 MHzclock is that the graphics FIFO read operation preferably is completedwithin one clock cycle in order to achieve a control feedbackconstraint. Read address preferably is generated on the rising edge of81 MHz clock and read data preferably is latched on the same edge. Thus,the graphics FIFO read preferably is performed by the falling edge ofthe clock to meet the feedback constraint.

As discussed earlier, graphics data loaded into the graphics FIFOs istypically packetized. On any display line, each graphics windowgenerally has a corresponding packet associated with it. A packet istypically comprised of a single-word packet header describing thegraphics window followed by the packet body comprised of graphics data.A header preferably is distinguished from the data body by a header/databit in each 129-bit FIFO word with a value of 1 indicating that the FIFOword is a header.

Window packet header preferably describes the properties of a graphicswindow. In one embodiment of the present invention, 129 bits in eachpacket preferably has the mapping as illustrated in Table 7.3.

TABLE 7.3 Bit Name Location Description DATA_TYPE 128 header (1) or data(0) indicator GFX_TYPE 127:124 graphics format FIRST_WIN 123 firstwindow of the current line indicator LINE_END 122 current line doneindicator ALFA_TYPE 121:120 alpha per pixel derivation methodWINDOW_ALPHA 119:112 single alpha for the whole window COLOR 111:96 window color used in alpha type of graphics 95:64 unused BLANK_CNT 63:58number of pixels to be blanked/ masked/unused at start of line VERT_EDGE 57 current line being top or bottom edge of the window indicatorWIN_START 56:46 window start location on horizontal direction LAYER45:42 window order in the z/depth direction FILT_ENB  41 YUV444 toYUV422 conversion using filter indicator WIN_SIZE 40:30 window size onthe horizontal direction 29:0  unused

A local two-entry read-ahead ping-pang FIFO preferably is created in thegraphics converter 0 2724A to interface with the graphics FIFO 0 2722Ain an attempt to provide a complete clock cycle for the followingprocessing pipe stages. The two-entry FIFO in the graphics converter 02724A preferably maintains its local pointers and monitors the graphicsFIFO 0 2722A for emptiness. If the local two-entry FIFO has space andthe graphics FIFO 0 2722A is not empty, graphics data preferably istransferred to the local two-entry FIFO. The local two-entry FIFOpreferably maintains the pointers for the graphics FIFO 0 2722A as wellas for itself upon freed local FIFO space or an asserted read strobegenerated by the internal finite state machine.

The endian-ness of graphics data preferably is handled by swapping bitsin the local FIFO word when reading it out. There typically are threecases to handle: little-endian where nothing is swapped, big-endian byteswap and big-endian 16-bit word swap.

A YUV422 image is typically considered to be a 32-bit quantity and noswapping is generally performed.

The graphics converter 0 2724A preferably includes a finite statemachine (FSM). The FSM preferably coordinates the processing of graphicspacket data in that pipeline and also reports its state vector to thegraphics controller. This FSM preferably has four states:

1) LINE_START: indicates that it is at the beginning of a graphics line.

2) HEADER: indicates that it is processing the header of a packet.

3) RETIRED: indicates that it has no more windows to process on currentline.

4) CONTENT: indicates that it is processing the graphics data of apacket.

The finite state machine (FSM) preferably is first reset to its initialstate, LINE_START, at system reset. When the graphics FIFO 0 2722Abegins to be filled with graphics data and graphics data is transferredto the local two-entry FIFO, the FSM preferably starts. At theLINE_START state, the FSM preferably automatically assumes that thefirst data is a header with its first_win bit turned on, otherwise FSMwaits until the start of next field.

The first_win bit preferably indicates that the corresponding graphicswindow is the first one on the current line.

If the FSM finds that the current line is empty, the FSM preferably goesto the RETIRED state, signaling that the current conversion pipeline isdone with the current line. Otherwise, it preferably goes to the nextstate, HEADER, to go ahead to process the header information.

At RETIRED state, the FSM preferably checks if all four conversionpipelines have retired for the current line. When it happens, itpreferably moves on to the next line and so the FSM enters into theLINE_START state.

At the HEADER state, the FSM preferably waits for the header informationto be processed and window parameters transferred to the local registersand preferably moves to the CONTENT state after one clock cycle when thedata in the local FIFO is recognized as valid header word.

At the CONTENT state, the FSM preferably enables the graphics dataprocessing. The FSM preferably remains in this state until all graphicsdata is processed for the current window and then preferably goes to: 1)RETIRED state if the current window is the last one at the current line;or, 2) HEADER state if there are more windows to be converted for thecurrent line.

The FSM preferably goes back and forth between HEADER state and CONTENTstate if there are more than one windows to be processed by the currentconversion pipeline.

A window of the format ALPHA 0 is in a special format that typicallydoes not have a data body in its packet. In this case, the FSM typicallymoves to the next packet by checking if the value of the virtual pixelcounter, xcnt, generated by the graphics controller has moved across thewindow right boundary. If it is true and the FSM sees the header of thenext packet, the FSM preferably switches to the HEADER state. Thegraphics controller preferably uses the virtual counter xcnt tosynchronize the four parallel conversion pipelines so that their outputsto the blenders are on the same pixels at any given time.

The FSM preferably also updates a read strobe signal, fifo_ren, wheneverit identifies: 1) an empty line; 2) a header; or 3) a end-of-lineindicator.

In one embodiment of the present invention, the following graphicspacket combinations are allowed:

-   -   1) a header-only packet indicating an empty line;    -   2) a data packet with its header indicating a first window at        current line followed by possible other packets and at last a        header-only packet indicating the end of current line.        Therefore, if a line is not empty, then the last packet        typically is a header-only packet with its LINE_END bit set.

All graphics packets are pre-sorted and put into the Graphics FIFO inthe order that the corresponding windows appear on the screen, from leftto right. The graphics converter preferably includes many types ofregisters. They typically are the same type of registers but generallykept and used for different pipeline delay stages.

An inactive window is defined as a window that a graphics converter hasalready started to work on (header already processed) but has no effecton the blended output because its horizontal range is outside of therange where the virtual counter is pointing at. An active window, on theother hand, is typically a window in range where the virtual counter ispointing at.

When a graphics window processed in any conversion pipeline is inactive,its absence is typically implicitly declared by zeroing its windowalpha, which is equivalent to zeroing out its presence in thefollowing-on blending process. This information preferably is alsopassed on to the graphics controller by concatenating it to the windowlayer number in the current conversion pipeline.

FIG. 70 is a process diagram of seven graphics data processing pipelinestages in a graphics converter in one embodiment of the presentinvention. The seven graphics data processing pipeline stages shown inFIG. 70 do not include header handling.

The first stage preferably is comprised of a data demultiplexing block2742. At this stage, a long data word coming out of the local two-entryFIFO preferably is first processed for endian-ness, followed bydemultiplexing to extract appropriate bits according to the graphicsformat and expected data size. If the graphics data is in CLUT format,corresponding lookup table input to a CLUT block 2744 preferably isprepared. If the graphics data is in RGB format, corresponding input toan RGB-to-YUV conversion block 2748 preferably is prepared.

The second stage preferably is comprised of a CLUT block 2744, a delayblock 2746 and a RGB-TO-YUV conversion block 2748. At this stage, colorand pixel alpha preferably is looked up for graphics in CLUT format fromthe CLUT as indicated in the CLUT block 2744. Similarly, RGB to YUV444conversion is performed on graphics in RGB format, as indicated inRGB-to-YUV block 2748. For graphics already in YUV 4:2:2 format,graphics pixel data is delayed by one clock cycle as indicated in thedelay block 2746.

The third stage preferably is comprised of a pixel alpha extractionblock 2750. At this stage, per-pixel alpha is derived according to theALPHA_TYPE for all types of graphics including keying operation if theALPHA_TYPE is of CHROMA_KEY type. In this stage, if the current graphicsline falls on the upper or lower edges of the graphics window processed,the pixel alpha for the window is preferably decreased by half toachieve better visual effect equivalent to filtering on the horizontalrunning edges.

The fourth stage preferably is comprised of a window alphamultiplication block 2752. At this stage, the window alpha, i.e., globalalpha, preferably is multiplied with corresponding per-pixel alpha toachieve global window fade-in/fade-out effect.

The fifth and sixth stages preferably are comprised of first and seconddelay blocks 2754 and 2756, respectively. At the fifth and sixth stages,converted graphics pixel data in YUV 4:4:4 format preferably are delayedone clock cycle at each stage to prepare for the YUV 4:4:4 to YUV 4:2:2three-tap horizontal filtering.

The seventh stage preferably is comprised of a YUV 4:4:4 to YUV 4:2:2conversion block 2758. At the seventh stage, if the original graphics isof the RGB, ALPHA, or CLUT type, then an optional YUV 4:4:4 to YUV 4:2:2conversion preferably is performed using a 1-2-1 3-tap filter kernel. Inone embodiment of the present invention, the optional YUV 4:4:4 to YUV4:2:2 conversion is enabled when the filter enable bit FILT_ENB is set.The color components as well as the per-pixel alpha, after beingmultiplied with the window alpha, may be filtered using the same filterkernel.

All RGB types of graphics preferably are first converted to a commonRGB16 (16-bit, R5, G6, B5) format before entering into the YUV 4:4:4 toYUV 4:2:2 conversion. This means that all RGB types of graphics otherthan RGB16 preferably are up-scaled to 16-bit for conversion to RGB16.In one embodiment of the present invention, during the conversion toRGB16, the lowest significant bits (LSBs) preferably are added to Red(R), Green (G) and blue (B) components to extend them to the bit size ofcorresponding RGB16 color components, i.e., R5/G6/B5.

In one embodiment of the present invention, during RGB16 to YUV 4:4:4conversion, each of the color components is bit extended to 8-bit andthen following formulas are applied to convert from the RGB16 colorspace to the YUV 4:4:4 color space:Y=((66×R)+(129×G)+(25×B)+16)/128;U=((−38×R)+(−74×G)+(112×B)+128)/128;V=((112×R)+(−94×G)+(−18×B)+128)/128.

Conversion from YUV 4:4:4 to YUV 4:2:2 typically requires sub-samplingof the U and V components. Pixel alpha preferably is filtered as well.If the graphics data is already in YUV 4:2:2 format, then the YUV 4:4:4to YUV 4:2:2 conversion is generally bypassed.

To achieve best visual quality, chroma preferably is pre-multiplied withthe alpha before the YUV 4:4:4 to YUV 4:2:2 conversion is performed.Alpha values preferably are filtered separately. Luma values preferablyare not filtered but pre-multiplied with the filtered alpha.

Since converted YUV 4:2:2 graphics generally assumes a co-sitedproperty, i.e., chroma on the even pixels logically belongs to the oddpixel and should also carry the same alpha value as for the odd pixels,at even pixels, the filtered alpha value is different for luma ascompared for chroma and the chroma uses the alpha value in the previouspixel, that of the odd pixels.

The bit width for the alpha value in the window descriptor and packetheader is 8-bit, which typically may represent numbers in the range of0-255. A true opaque image, however, generally requires that alpha isequal to 256. The alpha value of 255 preferably is selected to representthe value of 256. Thus, the alpha value of 255 is generally notavailable.

In the alpha output (combining pixel alpha value and window alpha valuetogether), nine bits preferably are used to represent each alpha value.In this case, alpha typically has a full dynamic range and there are nomissing values.

Referring back to FIG. 69, the color look-up tables (CLUT) 2726A-D aretypically comprised of two logical modules: a CLUT write port controllerand a RAM. The CLUT preferably is a one-write and four-read CLUT toprovide simultaneous read access for four conversion pipelines.

The CLUT write port preferably is controlled by a special window calleda LOAD_CLUT window. When graphics composites to the line that LOAD_CLUTis activated, the window controller preferably starts to update the CLUTwith new entries. There typically are two signals for the control,clut_mem_req and clut_data_wr. The clut_mem_req preferably synchronouslyresets the internal write port counter. While clut_mem_req is high, eachconsecutive clut_data_wr following the reset preferably updates one CLUTword and moves the write pointer to the next address location.

The logical 1-write-port and 4-read-port CLUT RAM preferably iscomprised of four single-port RAMs under the assumption that CLUT readand write do not happen at the same time. The CLUT RAM may also beimplemented in a single RAM.

The RAM preferably is 64 words deep and 128 bits wide to satisfy theSDRAM interface requirements (128-bit). Each CLUT word thereforepreferably contains 4 entries of 32-bit words, which are actually used.The graphics converter preferably de-multiplexes the word when used.

The graphics controller 2728 preferably performs the following tasks:

-   -   1) manages, coordinates and synchronizes the four conversion        pipelines, including generating virtual pixel count for them;    -   2) manages the usage of 6 graphics line buffers;    -   3) redirects converted graphics to appropriate blender inputs        according to their layer numbers;    -   4) maintains line buffer pointers.

The graphics controller 2728 preferably maintains a virtual pixelcounter, xcnt, to synchronize the four conversion pipelines to havetheir pixel processing aligned to each other. At the beginning of eachgraphics line, all four graphics converter pipelines preferablyinitialize themselves to a state LINE_START to and the virtual pixelcounter resets to 0.

For follow-on operations, pipelines are generally enabled if and only iffollowing conditions are met:

-   -   1) Either each convert pipeline is in the CONTENT state and its        local FIFO is not empty or has finished all the windows for the        current line; and    -   2) The line buffer receiving the graphics data is ready, either        there is a free line buffer (standard definition) or the line        buffer has room (high definition).

In other words, the pipelines are generally enabled when each conversionblock has processed their packet header successfully and enters into theCONTENT state for data processing or has exhausted all their windows atcurrent line.

Each individual pipeline preferably monitors xcnt to see if the windowprocessed is currently in range, i.e., xcnt points to a location theirwindows processed reside. If the window processed is currently not inrange, the pipeline preferably puts out a pixel equivalent to atransparent one so that it will have no effect on the net output whenblended with graphics windows from other pipelines.

When a particular pipeline is not ready to proceed (FIFO is empty orneeds to move to the next new window in the pipeline) then all pipelinestypically stall and wait for the particular pipeline to become readyagain.

The graphics blender 1 2730A and the graphics blender 2 2730B preferablyare first-level blenders and their outputs go to the graphics blender 3for the final blending.

The chroma preferably is blended independently from the luma, and viceversa. The video alpha, i.e., alpha for the video layers underneath thegraphics layers, is accumulated as well. Three multipliers are employed.One clock cycle is consumed during this blending.

As discussed earlier, since YUV 4:2:2 is co-sited, alpha values forchroma and luma are typically separated. Accumulation of alpha is onlyneeded for alpha_y which will be stored to line buffers later.

Similar to the graphics blender 1 2730A, the graphics blender 2 is a2730B first-level blender used to blend the third and fourth of the fourgraphics windows. Slightly different from graphics blender 1, thegraphics blender 2 generally receives the clear input of the thirdgraphics window. On the output side, it also generates a signal to tellif either the third or the fourth graphics window is the clear window.

Since the output of the graphics blender 2 is typically blended withoutput of the graphics blender 1 and so not only alpha_y is accumulatedbut alpha_c preferably is also accumulated. The graphics blender 2typically uses one clock cycle to perform all the operations.

The graphics blender 3 2730C is the final graphics blender whichpreferably takes outputs of the graphics blenders 1 and 2, and blendsthem together to produce a single 24-bit output, which is the blendedgraphics.

XXIII. Graphics Line Buffers Having a Single-Port RAM Used Similarly asa Dual-Port RAM

The graphics line buffer 2734 preferably is comprised of six linebuffers 2736A-F and a line buffer controller. The line bufferspreferably are synchronous to the 81 MHz clock. There generally are twodistinct cases for which line buffers 2736A-F are handled: standarddefinition (SD) mode and high definition (HD) mode.

When the video display is in the SD mode, graphics may be filteredvertically to remove flickers. A sample-rate-conversion may also beperformed to convert graphics designed in square-pixel aspect ratio tothe video display which has a aspect ratio of 4:3. In addition,filtering may also be performed on a frame-based graphics instead offield-based graphics. To perform these functions, a total of six linebuffers are typically required. These line buffers preferably aretreated as a circular FIFO such that buffers are recycled and releasedfor composition whenever they are freed by the filter.

When the video display is in the HD mode, graphics filtering isgenerally not performed. Thus, only one of the six line buffers isgenerally used. In this case, the single line buffer preferably istreated as a pixel FIFO such that graphics pixel data is composited andstored into the FIFO whenever there is space in it and is notline-based.

Thus, for the HD mode, only the line buffer 0 preferably is used as apixel FIFO. At field start, the FIFO read and write pointers typicallypoint at 0. The FIFO generally does not have data at beginning so theline buffers typically have nothing to send to the Display FIFO. Onlyafter the write address increments to 16 then the filter controllertypically starts to move data from the line buffer to the display FIFO.All subsequent transfers typically assume that the line buffer is notempty and has data to be transferred. The transfer preferably iscontrolled by a FIFO full/clear_full mechanism (for Display FIFO)similar to the ones used for line buffer control. In SD mode, since allline buffers are generally available prior to the time when displaystarts to use them, no such restriction is imposed.

A display FIFO preferably is a 16-word deep and 24-bit wide two-portFIFO implemented using a register file. In one embodiment of the presentinvention, the display FIFO is comprised of a RAM and a FIFO controller.The FIFO controller preferably uses a gray code for the read and writeaddress generation to ensure hazard-free operations on them to generatefull and clear_full signals, which are asynchronous in nature. Besidesthe asynchronous resets, synchronous resets preferably are also employedto reset the write and read pointers to their initial values in theirrespective clock domains.

The write port preferably also maintains two more counters, wpt_add8 andwpt_add9 to be used during generation of full and clear_full signals.They are typically a 8-word and 9-word look-ahead counters so that fullsignal is typically asserted if write pointer is 8-word ahead of readpointer and clear_full is asserted if the difference is 9.

In the case of SD mode, the graphics controller maintains a pointer toselect the line buffer that current graphics line preferably is to bestored to. At each line start, the pointer preferably changes its value.The number of new buffers that the filter has released preferably isindicated by three mutually exclusive indicators: 1 d_free_1, 1d_free_2, and 1 d_free_3. An internal buffer counter, num_free_ld,preferably keeps track of how many line buffers are ready for newlyblended graphics.

In the case of HD mode, a simple mutually exclusive two-wire control istypically used for the FIFO write: an ld_clear_full generated by thegraphics filter is generally asserted high when the FIFO is almost fulland ld_clear_full is generally asserted when FIFO has cleared out enoughroom for safe transfer of new composited graphics data.

ld_waddr is typically updated according to ld_wen. The latter one istypically related to the pipe_en_all control signal and has a scheduleddelay to account for blender pipeline delays.

The graphics blenders 2730A and 2730B typically expect graphics windowsfrom the four conversion pipelines in certain order, e.g., the layers toblender 1 preferably are logically underneath layers to blender 2. Inaddition, the two layers to blender 1 as well as to blender 2 arepreferably distinguished into bottom and top layers. The graphics comingout of the four conversion pipelines, however, generally are out oforder, so they preferably are sorted by the graphics controller 2728.The graphics controller 2728 preferably sorts the graphics windows basedon their layer numbers: graphics layers with smaller layer number aregenerally placed underneath others having a larger layer number.

The layer variable coming into the graphics controller preferably hasits MSB designated for a special purpose: the MSB is typically zero whenthe layer is not active. Thus, any layer having zero as the MSB of itslayer variable typically does not participate in the sorting throughreassigning the layer number to a largest number possible, a hex valueof ffff.

Sorting process preferably is a simple and classical two for-loopapproach. After sorting, corresponding blender inputs are multiplexedfrom the four input sources.

The line buffer controller typically performs a number of tasks. Theline buffer controller preferably generates full and clear_full signalsfor HD mode using the graphics line buffer 0 2736A as a pixel FIFO. Thefull and clear_full signals typically are mutually exclusive from theirfunctionality, i.e. write and read addresses are linearly incrementingand the full and clear_full signals generally are not asserted at thesame time. The full signal preferably is asserted when read addressreaches 8 locations away from write address and the clear_full signalpreferably is asserted when they are apart by 12 locations.

The line buffers are generally implemented using static RAM. A staticRAM is typically comprised of three major area-consuming portions: 1)cell; 2) sense amplifier; and 3) address decoder. The relativepercentages of these three portions in the total RAM area typicallychange when bit size, data size, or configuration of a RAM changes.Total cell area of a RAM generally does not change with the data/wordsize. The area of sense amplifier is generally determined by the totaloutput bit size. The area of an address decoder of a RAM is typicallyinversely proportional to the number of address bits, i.e., for RAMs ofthe same bit size, wider the data/word size, smaller the addressdecoder.

If a RAM is sufficiently big, then the total cell area typically is thedetermining factor for the total cell area. Site of each memory cell istypically is determined by the RAM configuration: if the RAM issingle-port, two-port or dual-port, or higher-number-port. The more theport number, the bigger the basic cell size and hence the RAM size andtherefore a design generally should avoid using multiple-port RAMbecause of this area consequence.

Line buffers are used extensively in image processing relatedapplications where image lines are stored and updated into a line bufferand at the same time read out concurrently for processing. Functionallythis generally requires a two-port or dual-port RAM because of therequirement of simultaneous access or read and write of the RAM. Linebuffers are typically large and the two-port or dual-port version isgenerally significantly bigger in size than the single-port counterpart.In most cases, two-port RAM generally occupies about 30% to 40% morearea than the single-port counterpart.

The graphics line buffers 2736A-F preferably are built with asingle-port static RAM (SRAM). The reason for being able to use asingle-port to replace the two-port RAM requirement is that RAM read andwrite may be scheduled such that they are performed at different cycles.A single-port RAM is much smaller physically than a two-port RAM. Thus,use of a single-port RAM typically results in savings to occupied chiparea.

Fortunately, RAM read and write are sequential for typically a lot ofapplications. In other words, sequential memory address are accessed forconsecutive reading operations, and likewise for the writing operations.Because of this property, read and write may be predicted, i.e., thenext read or write is at the address located by incrementing the currentaddress. Therefore, read and write operations may be interleaved suchthat read or write generally occurs on every other cycle instead ofevery cycle. Further, each read or write may perform two data word reador write by doubling the data width (while reducing the number of wordsby half). Since cell area is typically dominating for most line buffers,area is generally significantly reduced.

The following criteria generally needs to be met, however, to replace atwo-port RAM with a single-port RAM:

-   -   1) read and write preferably use the same clock or their control        signals are preferably generated using one clock reference;    -   2) both read and write ports preferably are linearly addressed.        Address jumping and consecutive same-address read or write        access preferably are not allowed;    -   3) both read strobe and write strobe preferably are provided;    -   4) when read or write ports are reset, neither write strobe nor        read strobe should typically be asserted.

Based on above assumptions, a scheme is used in one embodiment of thepresent invention to use a single-port RAM to do simultaneous read/writeaccess:

-   -   1) the RAM configuration is changed to make it twice as wide but        half as deep so that a single read/write for RAM using the new        configuration may perform read/write of two words at the same        time. This arrangement makes it possible that read or write        accesses to the RAM alternately, e.g., every other cycle in        average.    -   2) two local registers preferably hold two words scheduled for        the write request and RAM actual writes preferably happens when        read is not happening and at least two write data have been        accumulated.    -   3) real RAM read preferably happens when its address is even,        i.e., bit 0 of the address is 0.    -   4) read preferably has higher priority over write, i.e., when in        a cycle both read and write may be performed, then write        preferably waits until the next cycle. Since there are two local        registers to buffer the writes, the write data is not lost.    -   5) optionally, both read and write ports may be reset        periodically by their own resets. When these resets happen,        preferably no read or write is requested. But if the controller        found that there is still one write latched in the local        registers, it will generally flush and write only a single word        to the RAM when write port reset happens. In SD mode, these        resets typically happen at line start; and in HD mode they        typically happen at field start.

FIG. 71 is a block diagram of a dual-port SRAM 2762 having depth of Naddresses and a particular data width. The dual-port SRAM 2762 has botha write port and a read port. Thus, read and write operations may beperformed simultaneously. FIG. 72 is a single-port SRAM 2764 that hasbeen configured to emulate the data bandwidth of the dual-port SRAM ofFIG. 71. The single-port SRAM has a depth of N/2 addresses and a datawidth that is twice the data width of the dual-port SRAM in FIG. 71.Thus, twice as much data may be read or written simultaneously using thesingle-port SRAM 2764 of FIG. 72 as the dual-port SRAM 2762 of FIG. 71.Therefore, only a single port for both read and write operations may beused to achieve same data bandwidth as the dual-port SRAM of FIG. 71.

In the above embodiment of the present invention, the single-port SRAMused as line buffers is configured to have same bandwidth as thedual-port SRAM. However, this technique of saving chip area may havebroad applications to other memory devices such as synchronous dynamicrandom access memory (SDRAM) and flash memory devices. In addition, thistechnique may be used to save chip areas for other circuit componentssuch as FIFOs and frame buffers.

FIG. 73 is a block diagram of a graphics filter 2732 in one embodimentof the present invention coupled to the buffer 2734 comprised ofgraphics line buffers 0-5 2736A-F. The graphics filter 2732 is comprisedof three modules: a graphics filter controller 2776, a graphics filtercore 2772 and a display FIFO 2774.

The graphics filter 2732 preferably is used to perform aspect ratioconversion as well as to correct “flickers” on the vertical dimension.Thus the graphics filter 2732 is a single filter that serves dual roles.In one embodiment of the present invention, only vertical filtering isperformed. In other embodiments, both vertical and horizontal filteringmay be performed.

A high definition (HD) display typically has much finer verticalresolution than a standard definition (SD) display. In addition, the HDdisplay is square-pixel based. Thus, in the described embodiment, thegraphics filter 2732 preferably is used during the SD mode andpreferably is bypassed in the HD mode.

In other embodiments, graphics filters may filter the blended graphicsin HD mode as well as in SD mode. For example, the graphics filter 2732may be used for format conversion of graphics between HDTV-compatibleformat and SDTV-compatible format. For another example, the graphicsfilter 2732 may be used for format conversion of graphics between oneHDTV-compatible format and another HDTV-compatible format. In onespecific example in HD mode, the graphics format may be convertedbetween a format compatible with HDTV 720p format and another formatcompatible with HDTV 1080i format.

The filter core 2772 preferably is a 4-tap polyphase (FIR) filter.Design and application of polyphase filters are well known in the art.

In NTSC mode, which is one of the SD modes supported, scaling-down witha scale factor of 720/640 is typically performed to convert square-pixelgraphics to NTSC pixel aspect ratio. For PAL mode, which is another SDmode supported, a scaling-up of the same scale factor is generallyperformed.

The graphics filter 2732 preferably also supports frame-based orfield-based modes. Frame-based mode typically assumes that filtering hasbeen performed on the frame picture to achieve highest possible filterquality even though the output may be field-based. During field-basedmode, on the other hand, field-based pictures are used for both inputand output. A frame-based filtering consumes twice as much of input databandwidth as compared to field-based flittering.

As discussed earlier in reference to graphics line buffers, the graphicsline buffers preferably are implemented using a staggered read/write byfolding the RAMs and rescheduling read and write operations. Both readand write port resets are generated in the graphics filter controller asindicated by output 2778 of the graphics filter controller. For SD mode,reset preferably occurs at beginning of a display line and for HD mode,the reset preferably occurs at field start. In the case of HD or filterbypass modes, the second stage is skipped and filter is bypassed.

The filter operation may be expressed in a weighted sum of fourconsecutive graphics lines as follows:

${Output} = {\sum\limits_{n = 1}^{4}{W_{n} \times {Line}_{n}}}$W_(n) is the weight to be given to Line_(n) during summation. The filtercore 372 preferably performs the filter operation described above.

FIG. 74 is a block diagram of the filter core 2772 coupled to thedemultiplexer 2770. The ld_dat_sel signal 2780 preferably is used todemultiplex the six line buffers to four input lines for the filter core2772.

The graphics data preferably is first loaded in a register 2786. Comingout of the register 2786, the graphics data is multiplied with filtercoefficients COEF1-4 by multipliers 2788A-D, respectively. The resultsof the multiplications are stored in a register 2790. Coming out of theregister, the graphics data in first and second pipelines are summedtogether in a first adder 2792A. Similarly, the graphics data in thirdand fourth pipelines are summed together in a second adder 2792B. Theoutputs of the first and second adders are summed together in a thirdadder 2792C. The output of the third adder 2792C is stored in a thirdregister 2794, and then provided to a display FIFO.

Accordingly, the present invention provides a system for HDTV and SDTVapplications including capability for displaying video and graphics. Thesystem includes MPEG Transport and decode capabilities for video andaudio.

Although this invention has been described in certain specificembodiments, many additional modifications and variations would beapparent to those skilled in the art. It is therefore to be understoodthat this invention may be practiced otherwise than as specificallydescribed. Thus, the present embodiments of the invention should beconsidered in all respects as illustrative and not restrictive, thescope of the invention to be determined by the appended claims and theirequivalents.

1. A system comprising: an integrated circuit for providing blendedvideo and graphics, said integrated circuit comprising: an input forreceiving analog video; an input for receiving data representinggraphics; an input for receiving a plurality of compressed data streams,the compressed data streams including video data; a display engine forblending the data representing graphics to generate blended graphics; adigital video decoder for processing the video data to generate decodedvideo data; and a video compositor for blending the blended graphics andthe decoded video data to provide an output of blended video andgraphics; and wherein the display engine and the video compositor areseparate.
 2. The integrated circuit of claim 1 wherein the plurality ofcompressed data streams include one or more MPEG Transport streams. 3.The integrated circuit of claim 1 wherein the video data include HDTVvideo data.
 4. The integrated circuit of claim 1 wherein the video datainclude SDTV video data.
 5. The integrated circuit of claim 1 furthercomprising a system bridge controller for coupling a CPU to one or moreperipheral devices.
 6. The integrated circuit of claim 5 wherein the oneor more peripheral devices include one or more PCI devices, and whereinthe system bridge controller includes a PCI bridge to couple the CPU tothe one or more PCI devices.
 7. The integrated circuit of claim 1wherein the plurality of compressed data streams further include audiodata, and the integrated circuit further comprises an audio decodeprocessor for decoding the audio data.
 8. The integrated circuit ofclaim 1 wherein at least one of the plurality of compressed data streamsinclude data other than the video data or audio data.
 9. The integratedcircuit of claim 1 further comprising a core transport processor foraccepting or rejecting data packets from the plurality of compresseddata streams based on the value of a packet identification field of eachdata packet.
 10. The integrated circuit of claim 8 wherein one or moreof the plurality of compressed data streams include encrypted data, andthe core transport processor decrypts the encrypted data.
 11. Theintegrated circuit of claim 2 wherein the video data include MPEG videodata included in at least one MPEG Transport stream, and the integratedcircuit further comprises a satellite transport processor to extract theMPEG video data.
 12. The integrated circuit of claim 11 wherein thedigital video decoder is an MPEG video decoder for decoding the MPEGvideo data.
 13. The integrated circuit of claim 12 wherein the MPEGvideo decoder comprises one or more decode engines for concurrentlydecoding macroblock level video of two or more SLICEs.
 14. Theintegrated circuit of claim 13 wherein the one or more decode enginesinclude two decode engines, wherein each decode engine concurrentlydecodes macroblock level video of two SLICEs.
 15. The integrated circuitof claim 1 wherein the display engine converts the format of the datarepresenting graphics to a common format.
 16. The integrated circuit ofclaim 15 wherein the common format includes a YUV-alpha format.
 17. Theintegrated circuit of claim 1 wherein the display engine includes asingle-port SRAM configured equivalently as a dual-port SRAM.
 18. Theintegrated circuit of claim 1, wherein the display engine blends onlygraphics and not video.